Skip to content

Commit 94521e0

Browse files
author
Dominik Puk
committed
fix(jaxrs): PR comment
1 parent e673d7c commit 94521e0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • modules/openapi-generator/src/main/resources/JavaJaxRS/spec

modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
174174
{{#isArray}}
175175
public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
176176
{{#vendorExtensions.x-is-jackson-optional-nullable}}
177-
if (this.{{name}} == null || !this.{{name}}.isPresent()) {
177+
if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) {
178178
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}});
179179
}
180180
try {
@@ -216,7 +216,7 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
216216
{{#isMap}}
217217
public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
218218
{{#vendorExtensions.x-is-jackson-optional-nullable}}
219-
if (this.{{name}} == null || !this.{{name}}.isPresent()) {
219+
if (this.{{name}} == null || !this.{{name}}.isPresent() || this.{{name}}.get() == null) {
220220
this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}});
221221
}
222222
try {

0 commit comments

Comments
 (0)