You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The names of the apis are the _sanitized_ tags converted to _UpperCamelCase_ and are generated by the following steps:
201
+
- Execute the general [sanitization rules](#sanitization-rules)
202
+
- Prepend the word `Class` if the tag starts with numbers: `123_pet => Class123Pet`
203
+
- Convert the resulting string to upper camel case: `pet_store => PetStore`
204
+
197
205
To control generation of docs and tests for api and models, pass false to the option. For api, these options are `--global-property apiTests=false,apiDocs=false`. For models, `--global-property modelTests=false,modelDocs=false`.
198
206
These options default to true and don't limit the generation of the feature options listed above (like `--global-property api`):
199
207
@@ -447,7 +455,7 @@ will name the API method as `returnPetById` instead of `getPetById` obtained fro
447
455
448
456
## Schema Mapping
449
457
450
-
One can map the schema to something else (e.g. external objects/models outside of the package) using the `schemaMappings` option, e.g. in CLI
458
+
One can map the schema to something else (e.g. external objects/models outside the package) using the `schemaMappings` option, e.g. in CLI
Various identifiers have to go through a set of sanitization rules to remove invalid characters. This is performed by [DefaultCodeGen#sanitizeName](https://github.com/OpenAPITools/openapi-generator/blob/3ab495a0aa094eb9b1c7a46aea0adca8de8deeb6/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L6538C19-L6538C107).
661
+
662
+
Whenever an identifier is said to be sanitized, the following rules are being performed:
663
+
- Removes any occurrences of the substring `[]`: `input[] => input`
664
+
- Replaces indexing with underscores: `input[a][b] => input_a_b`
665
+
- Replaces parenthesized substrings with underscores: `input(a)(b) => input_a_b`
666
+
- Replaces dots, colons, and hyphens with underscores: `input.name, input:name, input-name => input_name`
667
+
- Replaces pipes with underscores: `a|b => a_b`
668
+
- Replaces spaces with underscores: `input name and age => input_name_and_age`
669
+
- Replaces forward and backward slashes with underscores: `/api/films/get, \api\films\get => _api_films_get`
670
+
- Removes all remaining non-word characters. Unicode characters are allowed if the `allowUnicodeIdentifiers`[config option](https://openapi-generator.tech/docs/configuration/) is true.
0 commit comments