Add model name mapping feature to C# codegen (#16209)

* add model name mapping feature to C# codegen

* rename file

* update samples

* update doc
This commit is contained in:
William Cheng
2023-08-02 10:06:11 +08:00
committed by GitHub
parent 3278eea9a4
commit 4602f18ca8
30 changed files with 509 additions and 59 deletions

View File

@@ -416,7 +416,16 @@ Here is an example to use `nameMappings` and `parameterNameMapping` in CLI:
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 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.)
To map model names, use `modelNameMappings` option, e.g.
```sh
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g csharp -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/csharp/ --model-name-mappings Tag=Label
```
will rename the Tag schema to Label instead.
(Not all generators support thess features 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.)
Related PRs: #16209 (modelNameMappings), #16194, #16206 (nameMappings, parameterNameMappings)
## Schema Mapping