forked from loafle/openapi-generator-original
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:
parent
fa97333a5c
commit
1fe7d703d7
@ -31,7 +31,7 @@
|
|||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
|
|
||||||
{{#hasVars}}
|
{{#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}}
|
{{#allVars}}
|
||||||
self.{{name}} = {{name}}
|
self.{{name}} = {{name}}
|
||||||
{{/allVars}}
|
{{/allVars}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user