mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
add parameter name mapping (#16160)
This commit is contained in:
@@ -397,7 +397,7 @@ or
|
||||
|
||||
## Name Mapping
|
||||
|
||||
One can map the name of the property/parameter to something else. Consider the following schema:
|
||||
One can map the property name using `nameMappings` option and parameter name using `parameterNameMappings` option to something else. Consider the following schema:
|
||||
```
|
||||
PropertyNameCollision:
|
||||
properties:
|
||||
@@ -411,12 +411,12 @@ One can map the name of the property/parameter to something else. Consider the f
|
||||
```
|
||||
`_type`, `type`, `type_` will result in property name collision in the Java client generator for example. We can resolve the issue using `nameMappings` by mapping `_type` to `underscoreType`, `type_` to `typeWithUnderscore`.
|
||||
|
||||
Here is an example to use `nameMappings` in CLI:
|
||||
Here is an example to use `nameMappings` and `parameterNameMapping` in CLI:
|
||||
```sh
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml -o /tmp/java2/ --name-mappings _type=underscoreType, type_=typeWithUnderscore
|
||||
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-okhttp-gson.yaml -o /tmp/java2/ --name-mappings _type=underscoreType, type_=typeWithUnderscore, --parameter-name-mappings _type=paramType, type_=typeParam
|
||||
```
|
||||
|
||||
(Not all generators support this feature yet. Please open an issue (ticket) to let us know which generators you would like to have this feature enabled and we'll prioritize accordingly.)
|
||||
(Not all generators support this feature yet. Please give it a try to confirm the behaviour and open an issue (ticket) to let us know which generators you would like to have this feature enabled and we'll prioritize accordingly.)
|
||||
|
||||
## Schema Mapping
|
||||
|
||||
|
||||
Reference in New Issue
Block a user