Bug Report Checklist
Description
After this fix: #21459, when the original string contains a hyphen, surrounded by spaces, the generated enum constant now has three underscores:
"This - string" becomes "THIS___STRING"
Suggested fix: In this file:
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java
Replace
modified = value.replaceAll("-", "_");
with:
modified = value.replaceAll(" - ", "_");
modified = value.replaceAll("-", "_");
It could also be that it needs to be fixed on a more fundamental level, because otherwise, there will probably be other edge cases as well.
openapi-generator version
7.15.0
Bug Report Checklist
Description
After this fix: #21459, when the original string contains a hyphen, surrounded by spaces, the generated enum constant now has three underscores:
"This - string" becomes "THIS___STRING"
Suggested fix: In this file:
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java
Replace
with:
It could also be that it needs to be fixed on a more fundamental level, because otherwise, there will probably be other edge cases as well.
openapi-generator version
7.15.0