-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[Swift] property, parameter name mapping support #16207
Conversation
internal var type: String? | ||
internal var type: String? | ||
internal var type: String? | ||
internal var type: String? |
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.
@wing328 all the properties have the same name, this won't compile
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.
yes, this won't compile without using the mapping option, e.g.
generatorName: swift5
outputDir: samples/client/petstore/swift5/nonPublicApi
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/swift5
generateAliasAsModel: true
additionalProperties:
podAuthors: ""
podSummary: PetstoreClient
sortParamsByRequiredFlag: false
nonPublicApi: true
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
nameMappings:
_type: underscoreType
type_: typeWithUnderscore
-type: dashType
parameterNameMappings:
_type: underscoreType
type_: typeWithUnderscore
-type: dashType
I removed the files as these files are not supposed to be included. You can refer to the diff in the description to understand the change before and after using nameMappings, parameterNameMappings in the config.
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.
And this is what the schema looks like that will result in naming collisions:
components:
schemas:
PropertyNameMapping:
properties:
http_debug_operation:
type: string
_type:
type: string
type:
type: string
type_:
type: string
-type:
type: string
tested locally and the diff looks like:
PR checklist
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*
.For Windows users, please run the script in Git BASH.
master
(6.3.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks)FYI @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) @dydus0x14 (2023/06)