-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug][Kotlin] Default typeMapping for 'date' should be LocalDate #2063
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
@jimschubert , @dr4ke616 : what's your take on that ? |
@legzo I do think this would be considered a bug. There's always a workaround with type mappings in that you can specify them on the command line. Some generators may set certain mappings in such a way that user overrides aren't supported (as with Kotlin client json types). If you're able to open a PR, that would be awesome. I'm in a crunch at work and it's been taking away from my open source contrib time. |
I've tagged this as client/server related, since this is in the base class. Will evaluate the full impact later. |
Hi @jimschubert, thanks for your feedback. As a matter of fact I overrid the mapping in the config of the generator, so there is a work around. However I find it deceptive that out of the box Jackson is not able to deserialize a model that is propertly typed and formatted in the json. I'll make a PR and you'll decide what to do with it :) Thank you for your open-source contrib by the way. Much appreciated. |
Bug Report Checklist
Description
When a spec specifies a property as :
the Kotlin generator generates the corresponding field as a
LocalDateTime
and later, the parsing fails when Jackson is used (Gson too) saying it cannot find a converter for this type.As I understand the spec,
"format":"date"
should result in aLocalDate
and"format":"date-time"
in aLocalDateTime
openapi-generator version
I tried version 3.3.4, but I read the code of master and the problem is still present.
Steps to reproduce
Use as an input any spec that has a property configured as :
Suggest a fix/enhancement
I think there is only one line to change at
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java
Line 175 in 0b66fa5
it should be
I can provide a PR if you think it is really a bug.
Cheers.
The text was updated successfully, but these errors were encountered: