-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Java] Fix missing underscores for PascalCase enum values #4837 #18594
[Java] Fix missing underscores for PascalCase enum values #4837 #18594
Conversation
8659914
to
06eaab2
Compare
@wing328 samples updated |
41e4593
to
3a6a427
Compare
3a6a427
to
edb4b0f
Compare
thanks for the PR, which has been merged. |
For those who need to fallback to previous naming convention, please use the enum name mapping option: https://github.com/openapitools/openapi-generator/blob/master/docs/customization.md#name-mapping |
An other workaround is https://openapi-generator.tech/docs/templating/#all-generators-core Still a PITA to have such a change in a minor version |
Is there a way to revert back to the old behavior, for instance by setting a configuration parameter? I think this is a bad change. If you want underscores in the enums then you can put them into the swagger instead. The suggested "workarounds" are not really workarounds since we build the code using general pipelines and don't want to hardcode any manual mappings. |
One should really not introduce undocumented breaking changes with minor versions... |
Please revert this change asap. Who is responsible for this and could do it? Maybe @wing328 ? This even introduces more bugs, e.g. "B2B" is now translated to "B2_B". |
I've filed #20172 to add the option Please give it a try when you've time. About including breaking changes with fallbacks in minor releases, please refer to the FAQ for more information: https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#can-you-explain-how-the-releases-are-versioned |
Thank you, William, both for the proposed fix (which I will test as soon as
I get planning approval) and the hint regarding the FAQ. I was not aware of
that! :)
Still it would be nice to mention these breaking changes in the Release
Notes :) I hope we can agree on that :)
Am Mo., 25. Nov. 2024 um 09:16 Uhr schrieb William Cheng <
***@***.***>:
… I've filed #19630
<#19630> to add the
option enumPropertyNaming (MACRO_CASE, legacy) so that one can set it to
legacy for fallback.
Please give it a try when you've time.
About including breaking changes with fallbacks in minor releases, please
refer to the FAQ for more information:
https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#can-you-explain-how-the-releases-are-versioned
—
Reply to this email directly, view it on GitHub
<#18594 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIGHS2IH4R2RRPQ6FXKMPH32CLMGVAVCNFSM6AAAAABHKS7XMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJXGE4TIMRYHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
In the release note (minor releases), there's a link to a list of breaking changes with fallbacks e.g. https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.7.0 |
you're right. updated the reply above. thanks |
update: PR merged. please give it a try with the latest master or snapshot version. |
@wing328 I only looked at your PR and didn't try it out but I think it's still broken. |
if your use cases didn't work before and after this PR (#18594), then please use enum name mapping option ( https://github.com/openapitools/openapi-generator/blob/master/docs/customization.md#name-mapping |
Hey, @wing328 !
Thank you. I certainly should read more documentation before making such remarks :) |
Resolves: #4837
Addresses an issue with the conversion of enum values to valid variable names. When the enum value is a string and contains multiple words without separators (e.g.,
TestCase
), underscores between the words were previously missing (e.g., "TESTCASE").To address this issue, the existing
underscore
method is now applied to the value before all characters are converted to uppercase letters. The underscore method converts CamelCase to SCREAMING_SNAKE_CASE while preserving the case of individual words (e.g.,TestCase
becomesTEST_CASE
)Corresponding tests have been added.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming 7.1.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)