Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in java code generation for Enumeration in swagger document #1176

Open
MeghaPunj opened this issue Aug 1, 2023 · 0 comments
Open

bug in java code generation for Enumeration in swagger document #1176

MeghaPunj opened this issue Aug 1, 2023 · 0 comments

Comments

@MeghaPunj
Copy link

For java code generation from swagger, for enums, there is a bug in code generation.
I have tried many versions so far but no luck. To replicate the issue, please take the latest stable version or this:

<swagger.codegen.version>3.0.45</swagger.codegen.version>
I have already added under properties:
<errorOnUnknownEnum>true</errorOnUnknownEnum>

The code generated has:

"Unexpected value '" + text + "' for 'MyTest' enum."
instead of:
"Unexpected value '" + input+ "' for 'MyTest' enum."

@JsonCreator
    public static TypeEnum fromValue(String input) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(input)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + text + "' for 'MyTest' enum.");
    }

Also there is mention of this change here:
#713

May be the same is missing in the latest version 3.x.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant