swagger-api / swagger-api/swagger-codegen
Error occurs while build generated typescript
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
On use the header menu item: Generate Client/typescript-angular all the definitions... All the definitions types with type:"string" and format: "date-time" returns in the generated models (into the models folder) a model with type "Date" and it should returns "string".
Swagger-codegen version
Version 4.0.1
Swagger declaration file content or url
birthdate:
properties:
type: string
format: date```
Generates a model .ts:
```ts
birthDate: string; // Well done!
birthdate:
properties:
type: string
format: date-time
Generates a model .ts:
birthDate: Date; // Wrong!
The format property isn't a Json primitive.
Steps to reproduce
- Declare a property with type: string and format: date
- Declare another property with type: string and format date-time
- Go to Menu /Generate Client / typescript-angular
- Open zip file and find into the /models folder the generated type is (string for date // Well and Date for date-time // Wrong)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the two YAML property definitions and inspect the typescript-angular generator path that produces files in the models folder. Compare the generated types for format: date and format: date-time, then verify the corrected output against both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, openapi, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100