Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.3k
[all] add "x-enum-varnames" extension to control enum varname#917
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| privatevoidupdateEnumVarsWithExtensions(List<Map<String,Object>>enumVars,Map<String,Object>vendorExtensions) { | ||
| if (vendorExtensions !=null &&vendorExtensions.containsKey("x-enum-varnames")) { | ||
| List<String>alias = (List<String>)vendorExtensions.get("x-enum-varnames"); | ||
| if (alias.size() ==enumVars.size()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Maye you could just log a warning if the sizes do not match.
In my opinion it is OK to still change the first two defined names in a case like this:
EnumProp:type:stringenum: -a -b -cx-enum-varnames: -FOO -BAR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I see.
Then I'll make changes to allow to set different number of elements from target enum.
jmini commentedAug 30, 2018
Tested with a java client generator with: EnumWithCustomName:type:integerformat:int32enum: -1 -2x-enum-varnames: -FOO -BAR The produced code |
jmini commentedAug 30, 2018
Thank you for this great contribution! |
wing328 commentedAug 30, 2018
@osjupiter thanks for the PR, which has been included in the v3.2.3 release:https://twitter.com/oas_generator/status/1035200785066254336 |
phstudy commentedSep 26, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The codegen of This issue was fixed in#1120. |
…ITools#917)* add "x-enum-varnames" extension to control the naming of the enum parameter name* allow to set different size from target enum
akhileshnair08 commentedAug 4, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
ABCEnum: Why is this not working??? |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,3.3.x,4.0.x. Default:master.Description of the PR
(details of the change, additional tests that have been done, reference to the issue for tracking, etc)
For issue#893
Add "x-enum-varnames" vendor extension to control names of generated enum properties.