Skip to content

Commit 190235a

Browse files
Marcel JacekMarcel Jacek
authored andcommitted
review feedback
1 parent d6b3243 commit 190235a

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
385385
{{#isArray}}
386386
{{#items.isModel}}
387387
{{#required}}
388-
if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) {
388+
if (jsonObj.get("{{{baseName}}}") != null{{#isNullable}} && !jsonObj.get("{{{baseName}}}").isJsonNull(){{/isNullable}}) {
389389
if (!jsonObj.get("{{{baseName}}}").isJsonArray()) {
390390
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString()));
391391
}

samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
204204
}
205205
}
206206
JsonObject jsonObj = jsonElement.getAsJsonObject();
207-
if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) {
207+
if (jsonObj.get("value") != null) {
208208
if (!jsonObj.get("value").isJsonArray()) {
209209
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be an array in the JSON string but got `%s`", jsonObj.get("value").toString()));
210210
}

samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
410410
} else if (!jsonObj.get("photoUrls").isJsonArray()) {
411411
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString()));
412412
}
413-
if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) {
413+
if (jsonObj.get("tags") != null) {
414414
if (!jsonObj.get("tags").isJsonArray()) {
415415
throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString()));
416416
}

0 commit comments

Comments
 (0)