swagger-api / swagger-api/swagger-codegen
Enums: @JsonValue annotation is missing from toString() in the generated model for language jaxrs
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Looked at issue #3611 #3615
It does not work for language jaxrs .
I tried using 2.2.3 and 2.3.0 lastest snapshot also.
java -jar swagger-codegen-cli-2.3.0.jar generate -i genapi.yaml -l jaxrs -o generated_server
public enum HealthType {
OVERALL("overall"),
CONNECTED("connected"),
ONBOARDED("onboarded");
private String value;
HealthType(String value) {
this.value = value;
}
@override
public String toString() {
return String.valueOf(value);
}
@jsoncreator
public static HealthType fromValue(String text) {
for (HealthType b : HealthType.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
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
Reproduce the swagger-codegen-cli generate command with the jaxrs language and inspect the template or entry point that produces the HealthType enum. Confirm the generated enum includes the missing JsonValue annotation on toString() and that the generated server output remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100