-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Improve documentation for customization #20841
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
base: master
Are you sure you want to change the base?
Conversation
thanks for pointing it out. i think that needs to be fixed. the mapping should be done using the original operationId provided in the spec (or auto-generated one if it's not defined) update: filed #20846 |
|
Updated based on the fix in #20846. |
docs/customization.md
Outdated
| To control the specific files being generated, you can pass a CSV list of what you want: | ||
| ```sh | ||
| # generate the User and Pet APIs only | ||
| --global-property apis="User,Pet" |
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.
looks like depending on the generators, e.g. for python
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g python -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/python --global-property apis="user:pet"
(note that colon is used as a separator)
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.
Nice catch, it is actually a colon for all generators. The --global-property option accepts a comma separated list of key value pairs, so none of the key/value pairs can have a comma in them. After the split on the comma is done to separate out each key/value pair, CodegenConfigurator replaces the colon with a comma:
configurator.addGlobalProperty(entry.getKey(), entry.getValue().replace(":", ","));
I was using a yaml config file with my actual schema I was generating at the time, so I never noticed I had it wrong since yaml doesn't have that issue.
At any rate, updated now to use the colon instead of the comma.
| --global-property models=User,supportingFiles=StringUtil.java | ||
| ``` | ||
|
|
||
| The names of the apis are the _sanitized_ tags converted to _UpperCamelCase_ and are generated by the following steps: |
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.
shall we mention it's not always upper camel case and it really depends on the generators (e.g. python uses snake case) ?
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 will have to dig into this since I am still missing a piece somewhere apparently. Will try to take a look again this weekend.
The documentation for selective generation of APIs has been updated to specify the API names are the sanitized UpperCamelCase versions of the tags in the spec. The sanitization rules have been documented in a separate section.
Closes #12215
The documentation for selective generation of APIs has been updated to specify the API names are the UpperCamelCase versions of the tags in the spec.
The documentation for use of operationIdNameMappings has been updated to specify that the operationIds have already been sanitized and converted to lowerCamelCase before they are compared with the specified operationIdNameMappings.
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(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)