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
Using dateLibrary option set to java8-localdatetime is not working as expected in case of spring-mvc library. I would expect the generated object model to use java.time.LocalDateTime but instead, it is using java.time.OffsetDateTime.
AbstractJavaCodeGen contains logic to choose the right dateTime implementation (code) but that is rudely overridden by SpringCodegen (code).
Removing those 4 lines of overriding code from SpringCodegen seems to fix the issue and should not have any adverse side-effect (as Java8 is the default date library anyway in case of SpringCodegen).
I'll prepare a pull request so you can review it.
BTW, I'm aware that using LocalDateTime is not according to Swagger spec, but I'm maintaining an existing API and it will take time to migrate users to start using OffsetDateTime. And the logic to use LocalDateTime is already there, so I think users should have that option available and working as advertised by Swagger Codegen documentation.
Swagger-codegen version
All versions of SpringCodegen that I could see on GitHub.
The text was updated successfully, but these errors were encountered:
* master: (133 commits)
add a link to ebook (polish version)
Add R namespace file (swagger-api#7467)
Add Spring Petstore samples (async, java8-localdatetime) to CircleCI (swagger-api#7468)
Revised core team members
Ada code generator corrected: "=>" instead of "->". Fixesswagger-api#7450 (swagger-api#7456)
Fixes issue swagger-api#7177 (SpringCodeGen dateLibrary "java8-localdatetime" option is ignored). (swagger-api#7178)
Issue-7438 Fix that prevents generating interfaces when interfaceOnly is false. (swagger-api#7439)
swagger-api#7093 - Add maven wrapper (swagger-api#7356)
[csharp] Support arrays of arrays for properties and models (swagger-api#7400)
[csharp] Fix ToJson to work with composition and polymorphism (swagger-api#7399)
[csharp] Reference this.Configuration in client api template (swagger-api#7394)
[JAX-RS][Spec] Removes throws Exception. (swagger-api#7437)
Use supportsES6 flag in ts compilation for language typescript-angular (swagger-api#7408)
Fix 7457: [Ada] wrong order for generated structures in *-models.ads (swagger-api#7462)
Fix 7459: [Ada] wrong JSON in POST operations (swagger-api#7460)
[erlang-client] Erlang request utils (swagger-api#7257)
reenable pushing snapshot to maven repo
Create CODE_OF_CONDUCT.md
comment out update to docker image
deleted unnecessary notes (swagger-api#7454)
...
viclovsky
pushed a commit
to viclovsky/swagger-codegen
that referenced
this issue
Jan 23, 2018
Description
Using
dateLibrary
option set tojava8-localdatetime
is not working as expected in case ofspring-mvc
library. I would expect the generated object model to usejava.time.LocalDateTime
but instead, it is usingjava.time.OffsetDateTime
.AbstractJavaCodeGen
contains logic to choose the right dateTime implementation (code) but that is rudely overridden bySpringCodegen
(code).Removing those 4 lines of overriding code from
SpringCodegen
seems to fix the issue and should not have any adverse side-effect (as Java8 is the default date library anyway in case ofSpringCodegen
).I'll prepare a pull request so you can review it.
BTW, I'm aware that using
LocalDateTime
is not according to Swagger spec, but I'm maintaining an existing API and it will take time to migrate users to start usingOffsetDateTime
. And the logic to useLocalDateTime
is already there, so I think users should have that option available and working as advertised by Swagger Codegen documentation.Swagger-codegen version
All versions of
SpringCodegen
that I could see on GitHub.The text was updated successfully, but these errors were encountered: