swagger-api / swagger-api/swagger-codegen
[Spring] Spring generator overwrites dates mappings when using java8
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When using java8=true in the Spring generator, SpringCodegen uses the same type mappings and import mappings which are used in AbstractCodegen for dateLibrary=java8.
If the setup of the date libraries is already done in AbstractJavaCodegen maybe the Spring generator shouldn't be concerned with it.
Swagger-codegen version
Latest from master
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i swagger.json -l spring -o build -D hideGenerationTimestamp=true --additional-properties dateLibrary=java8-localdatetime,java8=true
Steps to reproduce
Just something I saw in the code. I don't know the implications of the issue in terms of the generated code.
Suggest a Fix
My guess is it could be fixed in SpringCodegen simply by not doing anything related to dates.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect the date setup in SpringCodegen, AbstractCodegen, and AbstractJavaCodegen, then reproduce the issue with the provided java -jar generation command and dateLibrary properties. Compare the type and import mappings before and after SpringCodegen runs; done means the Spring generator no longer overwrites the mappings established for Java 8 dates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100