Open Noed opened 4 months ago
Hello, I got the same issue (different behaviour in my Java Enum generation between 7.6.0 and 7.7.0).
I suspect this commit to be the root cause : https://github.com/OpenAPITools/openapi-generator/commit/bfa26ea6be6af4984f94b60c67bc4fb0a5d76181#diff-a98cba8ecadaf5a662edc508aa5857972339552ec6bd6e4216680c7c6070e643
which is linked to this request https://github.com/OpenAPITools/openapi-generator/issues/4837
Sadly it seems that we can't change this behavior (some generator have the option to choose the 'enumPropertyNaming' - 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'), a feature request has been opened for Java/Spring : https://github.com/OpenAPITools/openapi-generator/issues/18987
please refer to https://github.com/OpenAPITools/openapi-generator/pull/18594#issuecomment-2121945653 on how to fallback
Is there an option to just use the enum as is? Without any futher modifications?
Any idea when https://github.com/OpenAPITools/openapi-generator/pull/19277 will be merged?
@AndresBena19 +1000
Bug Report Checklist
Description
ENUM is being generated with additional "_" character when there's a number on the ENUM name.
openapi-generator version
Issue started on 7.7.0, works fine on 7.7.6.
OpenAPI declaration file content or url
Example ENUM attribute in the YAML spec:
Generation Details
Java 17, Gradle build.
Steps to reproduce
Add ENUM attribute to the spec that has numbers in the attribute name. Generate java model using openapi generator 7.7.0. Look into the source code generated, the ENUM attribute names will have an "_" after the number.
For example:
Related issues/PRs
Suggest a fix