[JAVA] Non compilable enums generated with property errorOnUnknownEnum=true
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Inspect the linked commit, especially lines 47 and 53, and reproduce the problem by generating Java enums with swagger-codegen-maven-plugin and errorOnUnknownEnum=true. Confirm that the generated enums compile and that the exception message uses the renamed parameter input rather than the stale name text.
Written by the indexing model from the issue text.
Description
Description
Since version 3.0.30, Java enum generated with IllegalArgumentException is not compilable. In commit linked bellow, method parameter was renamed from text to input, but was left as text in the exception message.
Swagger-codegen version
Since version 3.0.30, issue still present in 3.0.34.
Swagger declaration file content or url
Any open api definition containing enum is impacted.
Command line used for generation
Generated using swagger-codegen-maven-plugin.
Steps to reproduce
- Create yaml specification containing enum.
- Generate Java code using swagger-codegen-maven-plugin with additional property errorOnUnknownEnum=true.
<additionalProperties>
<additionalProperty>errorOnUnknownEnum=true</additionalProperty>
</additionalProperties>
- Check generated Java enums.
Related issues/PRs
Issue introduced in commit: https://github.com/swagger-api/swagger-codegen-generators/pull/978/commits/065a98cddb111015f25782f223eb159569220f68
Line 47: renamed parameter
Line 53: non compilable exception is thrown
Suggest a fix/enhancement
Simply update the thrown exception message with the new parameter name input.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
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.
More from swagger-api/swagger-codegen
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swagger-api/swagger-codegen#12755 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
swagger-api/swagger-codegen#12445 ·
-
security vulnerability
Difficulty 1/5 Under an hour Newbie friendliness 62/100
swagger-api/swagger-codegen#11942 ·
-
security vulnerability
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
swagger-api/swagger-codegen#11594 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
swagger-api/swagger-codegen#10969 ·
All issues in swagger-api/swagger-codegen
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
hemilabs/ui-monorepo#2332 ·
-
Help-Wanted Needs-Triage Package-Update
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/winget-pkgs#438662 ·
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·