openapi-generator
openapi-generator copied to clipboard
[BUG][codegen] String enum value NO transforms to FALSE
trafficstars
Bug Report Checklist
- [X] Have you provided a full/minimal spec to reproduce the issue?
- [ ] Have you validated the input using an OpenAPI validator (example)?
- [X] What's the version of OpenAPI Generator used?
- [X] Have you search for related issues/PRs?
- [X] What's the actual output vs expected output?
Description
I have a YAML file that contains a string enum type:
countryCode:
type: string
enum:
- DE
- FR
- NO
...
In the generated Java code (jaxrs-cxf), this transforms to
public enum CountryCode {
DE("DE"),
FR("FR"),
FALSE("false"),
...
Obviously, the last entry should be NO("NO") instead.
openapi-generator version
openapi-generator-maven-plugin 4.3.1
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix
Also, enum value OFF transaforms to false too
Same here, OFF->false. Is there known fix/workaround?
Same here. What could be causing this?
That's actual problem with the YAML parser ( even more - not a problem, that's valid behavior), we need to add single or double quotes to the schema to fix that.
For example:
countryCode:
type: string
enum:
- 'DE'
- 'FR'
- 'NO'
...