Bug Report Checklist
Example Spec:
[...]
paths:
/test-api:
get:
operationId: testApi
parameters:
- name: dateParameter
in: query
schema:
type: string
format: date
required: true
[...]
Description
#22246 introduced a new behaviour regarding query parameter expansion. This breaks the current behaviour with non-primitive types, i.e. Date and DateTime.
The above spec generates:
if (requestParameters['dateParameter'] != null) {
queryParameters['dateParameter'] = requestParameters['dateParameter'];
}
whereas v7.16.0 would have generated:
if (requestParameters['dateParameter'] != null) {
queryParameters['dateParameter'] = (requestParameters['dateParameter'] as any).toISOString().substring(0,10);
}
Adding explode: false to the request parameter restores the old behaviour, but having to set explode to false for non-array types does not match my understanding of the spec. Furthermore, exploding arrays of Date/DateTime objects would not work either.
openapi-generator version
v7.17.0, it works in v7.16.0. This is a regression.
Steps to reproduce
Run the typescript-fetch generator against the provided spec with default configuration.
Related issues/PRs
Suggest a fix
I would suggest applying the Date/DateTime to String conversion regardless of explode being set or not.
I will (hopefully) provide a PR later today to address this issue.
Bug Report Checklist
Example Spec:
Description
#22246 introduced a new behaviour regarding query parameter expansion. This breaks the current behaviour with non-primitive types, i.e. Date and DateTime.
The above spec generates:
whereas v7.16.0 would have generated:
Adding
explode: falseto the request parameter restores the old behaviour, but having to setexplodeto false for non-array types does not match my understanding of the spec. Furthermore, exploding arrays of Date/DateTime objects would not work either.openapi-generator version
v7.17.0, it works inv7.16.0. This is a regression.Steps to reproduce
Run the
typescript-fetchgenerator against the provided spec with default configuration.Related issues/PRs
Suggest a fix
I would suggest applying the Date/DateTime to String conversion regardless of explode being set or not.
I will (hopefully) provide a PR later today to address this issue.