You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The generated ApiClient.java (using <dateLibrary>java8</dateLibrary> and <library>resttemplate</library>) contains a method parameterToString, which is used to convert arbitrary e.g. query-parameters to a string-representation. This method always checks for java.util.Date to apply the DateFormat, which will never match when using OffsetDateTime (<dateLibrary>java8</dateLibrary>). Therefore, String.valueOf(..) is used, which does not yield the same result as using the RFC3339DateFormat.
Expected :2020-08-11T14:16:40.013Z
Actual :2020-08-11T16:16:40.013502900+02:00
Related issues/PRs
Not that I could find any.
Suggest a fix
When <dateLibrary>java8</dateLibrary> is provided the date-formatting in the ApiClient-template should check for OffsetDateTime, instead of java.util.Date in parameterToString.
A less intrusive fix would be adding the following else-if to the checks in parameterToString:
Bug Report Checklist
Description
The generated
ApiClient.java
(using<dateLibrary>java8</dateLibrary>
and<library>resttemplate</library>
) contains a methodparameterToString
, which is used to convert arbitrary e.g. query-parameters to a string-representation. This method always checks forjava.util.Date
to apply theDateFormat
, which will never match when using OffsetDateTime (<dateLibrary>java8</dateLibrary>
). Therefore,String.valueOf(..)
is used, which does not yield the same result as using theRFC3339DateFormat
.openapi-generator version
4.2.0
OpenAPI declaration file content or url
irrelevant
Generation Details
Steps to reproduce
ApiClient#parameterToString
java.util.Date
instead ofOffsetDateTime
.See the following test-case to show that the output is not identical and might therefor fail on a subsequent parse:
Related issues/PRs
Not that I could find any.
Suggest a fix
When
<dateLibrary>java8</dateLibrary>
is provided the date-formatting in the ApiClient-template should check forOffsetDateTime
, instead ofjava.util.Date
inparameterToString
.A less intrusive fix would be adding the following else-if to the checks in
parameterToString
:The text was updated successfully, but these errors were encountered: