OpenAPITools / OpenAPITools/openapi-generator
[REQ] Don't use @JsonCreator in Java enums
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
When applied to an enum property, Jackson's @JsonValue automatically provides a two-way translation that is likely to be more efficient than the generated fromValue. The @JsonCreator annotation is unnecessary and should be retired.
Applies to 3.3.4 and 4.0.0-beta3.
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
Start by tracing the Java enum generation path and locating where @JsonCreator and fromValue are emitted; the issue names no files or tests. Verify how @JsonValue handles enum deserialization, then confirm that generated Java enums omit the unnecessary annotation while retaining the requested two-way translation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100