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 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.
The names of the apis are the _sanitized_ tags converted to _UpperCamelCase_. The sanitization and camelization process performs the following steps:
201
+
- Follows the general [sanitization rules](#sanitization-rules)
202
+
- Prepends the word `Class` if the tag starts with numbers: `123_pet => Class123Pet`
203
+
- Converts 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`):
will name the API method as `returnPetById` instead of `getPetById` obtained from OpenAPI doc/spec.
447
455
456
+
The `operationId` has had some transformations performed on it prior to being looked up in the operation id name mappings. The following transformations have been performed:
457
+
- If the operationId is blank, the path is used to generate an operationId as follows:
458
+
- If the path is just the root path (/), it is replaced with the word `root`: `/ => root`
459
+
- All curly braces for path template parameters are removed: `/pets/{pet-name} => /pets/pet-name`
460
+
- The HTTP method is appended to the path: `/pets/pet-name/get`
461
+
- The resulting string is split on `/`
462
+
- The parts are joined together to form a lowerCamelCase string: `/pets/pet-name/get => petsPet-nameGet`
463
+
- The resulting operationId has the general [sanitization rules](#sanitization-rules) applied: `petsPet-nameGet => petsPetNameGet`
464
+
- If the operationId is not blank, it is used unmodified
465
+
- If the `removeOperationIdPrefix`[config option](https://openapi-generator.tech/docs/configuration/) is true:
466
+
- The operationId is split on the `removeOperationIdPrefixDelimiter` character (default: `_`)
467
+
- The `removeOperationIdPrefixCount` parts are discarded (default: `1`)
468
+
- The remaining parts are joined using `removeOperationIdPrefixDelimiter`: `data_pets_get => pets_get`
469
+
- The `removeOperationIdPrefixDelimiter` and the `-_:;#` characters are removed after capitalizing the subsequent character
470
+
- The first character is converted to lowercase to yield a lowerCamcelCase operationId
471
+
472
+
The lowerCamelCase operationId generated from the above transformations is the value that must be configured as the key in the operationIdNameMappings.
473
+
448
474
## Schema Mapping
449
475
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
476
+
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. Whenever an identifier is said to be sanitized, the following rules are being performed:
679
+
- Removes any occurrences of the substring `[]`: `input[] => input`
680
+
- Replaces indexing with underscores: `input[a][b] => input_a_b`
681
+
- Replaces parenthesized substrings with underscores: `input(a)(b) => input_a_b`
682
+
- Replaces dots, colons, and hyphens with underscores: `input.name, input:name, input-name => input_name`
683
+
- Replaces pipes with underscores: `a|b => a_b`
684
+
- Replaces spaces with underscores: `input name and age => input_name_and_age`
685
+
- Replaces forward and backward slashes with underscores: `/api/films/get, \api\films\get => _api_films_get`
686
+
- 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