swagger-api / swagger-api/swagger-codegen

Enums: @JsonValue annotation is missing from toString() in the generated model for language jaxrs

Open
#6,587 8 comments 2 reactions 0 assignees View on GitHub

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.