OpenAPITools / OpenAPITools/openapi-generator
[BUG] [typescript-fetch] Parameters with format: date are treated like date-time instead
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
If I specify a request with a date parameter, with type: string and format: date, then according to relevant documentation, this should be formatted as "2017-07-21", but it is instead formatted as "2017-07-21T17:32:28Z".
openapi-generator version
org.openapi.generator version 6.6.0
using the typescript-fetch generator.
OpenAPI declaration file content or url
parameters:
name: startDate
in: query
schema:
type: string
format: date
Generation Details
Steps to reproduce
Simply generate any client with above snippet and look at the output or call the client with any Date object.
Suggest a fix
The generated code does:
queryParameters["startDate"] = (requestParameters.startDate as any).toISOString();
where it should be doing:
queryParameters["startDate"] = requestParameters.startDate.toISOString().split('T')[0];
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
No repository file or test is named. Generate a typescript-fetch client from the provided YAML parameter and inspect the generated query serialization shown in the report. Done means a parameter with format: date is serialized as a date-only value such as "2017-07-21", rather than date-time output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100