Description
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.
Description
Using
dateLibraryoption set tojava8-localdatetimeis not working as expected in case ofspring-mvclibrary. I would expect the generated object model to usejava.time.LocalDateTimebut instead, it is usingjava.time.OffsetDateTime.AbstractJavaCodeGencontains logic to choose the right dateTime implementation (code) but that is rudely overridden bySpringCodegen(code).Removing those 4 lines of overriding code from
SpringCodegenseems 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
LocalDateTimeis 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 useLocalDateTimeis 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
SpringCodegenthat I could see on GitHub.