forked from loafle/openapi-generator-original
Add nullable array support in spring (#2660)
* Add nullable support in spring * fix forgot unescape defaultValue * Fix syntax error
This commit is contained in:
parent
e17890d526
commit
ff0d4eb8d7
@ -44,11 +44,11 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}
|
|||||||
|
|
||||||
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
|
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
|
||||||
{{^required}}
|
{{^required}}
|
||||||
if (this.{{name}} == null) {
|
if (this.{{name}} == null{{#isNullable}} || !this.{{name}}.isPresent(){{/isNullable}}) {
|
||||||
this.{{name}} = {{{defaultValue}}};
|
this.{{name}} = {{#isNullable}}JsonNullable.of({{{defaultValue}}}){{/isNullable}}{{^isNullable}}{{{defaultValue}}}{{/isNullable}};
|
||||||
}
|
}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
this.{{name}}.add({{name}}Item);
|
this.{{name}}{{#isNullable}}.get(){{/isNullable}}.add({{name}}Item);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user