OpenAPITools / OpenAPITools/openapi-generator
[BUG][Typescript-Fetch] Regression on date query parameter serialization
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists? ->(Tried both 5.4.0 and 6.0.0 SNAPSHOTS)
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Date type serialization for date-time format query parameter does not seem to work.
The expected behavior would be to create an ISOstring, but instead simple string conversion is used.
HOLD ON
This could just be user error on my side, the issue should be fixed according to this PR in 5.1.0 but I was not able to get decent Date query serialization on the 5.1.0 jar
https://github.com/OpenAPITools/openapi-generator/pull/8616
openapi-generator version
5.1, 5.4, 5.4-SNAPSHOT, 6.0.0-SNAPSHOT, It might be a regression, since this should have been fixed on 5.1
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: badDateSerialization
version: '1.0'
servers:
- url: 'http://localhost:3000'
paths:
'/some-endpoint/{datetime}':
parameters:
- schema:
type: string
format: date-time
name: datetime
in: path
description: a datetime
required: true
get:
summary: ''
operationId: get-users-userId
responses:
'200':
description: OK
Results in this DefaultApi:
https://gist.github.com/MartijnGevaert/5352550eae90acb53138fc519a5ffd6c
Generation Details
In my project:
java -jar ./openapi-generator-cli.jar generate -i ./backend_openapi_spec.yaml -o ../../react_frontend/src/Api/generated -g typescript-fetch
Steps to reproduce
Creating the fetch api frontend code without any options whatsoever results in the behavior.
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/pull/8616
Suggest a fix
It seems that the related PR mentioned above has a commit AFTER the branch has been merged, this might contain the fix for this issue.
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 running the supplied OpenAPI 3.0.3 declaration with the typescript-fetch generator command and inspect the generated DefaultApi shown in the linked gist. Compare the behavior with PR #8616, including its later commit, and clarify whether the reproduction uses a query or path parameter. Done means date-time parameters serialize to the expected ISO string and the regression is covered by a reproducible test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100