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
Run the command above;
View generated Request.java which contains the following invalid variable initialization:
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-07-24T10:22:22.238+10:00[Australia/Sydney]")
publicclassRequest {
publicstaticfinalStringSERIALIZED_NAME_END_DATE = "endDate";
@SerializedName(SERIALIZED_NAME_END_DATE)
privateLocalDateendDate = 1900-01-01; // <--- Type mismatch: cannot convert from int to LocalDatepublicstaticfinalStringSERIALIZED_NAME_START_DATE = "startDate";
@SerializedName(SERIALIZED_NAME_START_DATE)
privateLocalDatestartDate;
...
Related issues/PRs
None known.
Suggest a fix
In the toDefaultValue(Schema) method of org.openapitools.codegen.languages.AbstractJavaCodegen the default value for a date is returned as a String representation of the date, but should probably be a call to LocalDate.parse or similar.
The text was updated successfully, but these errors were encountered:
Description
Model properties that are dates generate invalid Java code where a default value is specified.
openapi-generator version
v5.0.0-beta
OpenAPI declaration file content or url
Command line used for generation
java -jar openapi-generator-cli-5.0.0-beta.jar generate -i test.json -g java -o .\output --additional-properties dateLibrary=java8-localdatetime
Steps to reproduce
Run the command above;
View generated
Request.java
which contains the following invalid variable initialization:Related issues/PRs
None known.
Suggest a fix
In the
toDefaultValue(Schema)
method oforg.openapitools.codegen.languages.AbstractJavaCodegen
the default value for a date is returned as aString
representation of the date, but should probably be a call toLocalDate.parse
or similar.The text was updated successfully, but these errors were encountered: