Skip to content
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][client] Wrong date-time object by default #4834

Closed
2 of 6 tasks
4brunu opened this issue Dec 18, 2019 · 1 comment · Fixed by #4835
Closed
2 of 6 tasks

[BUG][kotlin][client] Wrong date-time object by default #4834

4brunu opened this issue Dec 18, 2019 · 1 comment · Fixed by #4835

Comments

@4brunu
Copy link
Contributor

4brunu commented Dec 18, 2019

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

By default, the Kotlin client uses LocalDateTime to represent the date-time received from the server.
This is because because LocalDateTime doesn't have a notion of timezone.

openapi-generator version

4.2.2

Steps to reproduce
Related issues/PRs
Suggest a fix

It would be better to represent the date time received by the server in a OffsetDateTime which contains the timezone information.
The Java generator and the KotlinSpringServer also use the OffsetDateTime.

additionalProperties.put("threetenbp", "true");
additionalProperties.put("jsr310", "true");
typeMapping.put("date", "LocalDate");
typeMapping.put("DateTime", "OffsetDateTime");
importMapping.put("LocalDate", "org.threeten.bp.LocalDate");
importMapping.put("OffsetDateTime", "org.threeten.bp.OffsetDateTime");

typeMapping.put("date", "java.time.LocalDate");
typeMapping.put("date-time", "java.time.OffsetDateTime");
typeMapping.put("Date", "java.time.LocalDate");
typeMapping.put("DateTime", "java.time.OffsetDateTime");

@auto-labeler
Copy link

auto-labeler bot commented Dec 18, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant