Provides a default nil value for optional init parameters (#6827)

The following change can be helpful to create Swift model objects more simply, in particular when they have many parameters.
In addition, projects switching from swagger-codegen to OpenAPI will not encounter compilation errors and will not need to refactor old code
This commit is contained in:
Alessio Zurru 2020-07-01 18:13:08 +02:00 committed by GitHub
parent fa97333a5c
commit 1fe7d703d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@
{{/allVars}}
{{#hasVars}}
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allVars}}) {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init({{#allVars}}{{name}}: {{{datatypeWithEnum}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allVars}}) {
{{#allVars}}
self.{{name}} = {{name}}
{{/allVars}}