swagger-api / swagger-api/swagger-codegen
[java] Enum conversion in Java (for Jersey as well as retrofit) is not happening appropriately
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
@wing328
Enum conversion in Java (for Jersey as well as retrofit) is not happening appropriately.
For e.g
I have following structure:
Car:
Type: string
Enum: [“ford”, “chevy”, “lexus”]
MyProfile:
Properties:
MyCar:
Type: “#/definitions/Car”
Then, for jersey, car.java gets generated correctly with Car object as enum, but MyCar object gets messed up, as it gets generated as complete new class with no type information.
For retrofit, this is completely broken. Car object itself gets generated as broken object without any enum tag or specified values.
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 reproducing the reported Car and MyProfile schema with the Java Jersey and Retrofit generators. Compare the generated Car enum and MyCar property, then inspect the generator paths for both targets. Done means referenced enums retain their type and values in Jersey output, and Retrofit output generates the same enum information correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100