swagger-api / swagger-api/swagger-codegen

[Java] TypeMappings/ImportMappings don't work for Date/DateTime

Open
#3,943 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java Issue: Workaround available
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

This is because joda which is now the default overrides those values. It also happens if you choose java8 (for example, you choose java8 and want to change OffsetDateTime to Instant or ZonedDateTime).

Note : the workaround is to set dateLibrary to "custom" or "legacy" or "whatever"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by reproducing the Java generator behavior with the joda and java8 date libraries, comparing TypeMappings and ImportMappings against the documented custom or legacy workaround. Done means user-provided mappings for Date/DateTime, including OffsetDateTime, Instant, and ZonedDateTime, take effect without changing dateLibrary.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.