From 3ae37e27a52e349b139f2a581097c781520622f3 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 7 Oct 2022 23:06:34 +0800 Subject: [PATCH] [java][okhttp-gson] fix validateJsonObject (#13630) * fix required check in java okhttp client * fix validateJsonObject in okhttp-gson, add test * move java-micronaut-client to test circleci --- .../workflows/samples-java-client-jdk11.yaml | 3 -- .../Java/libraries/okhttp-gson/pojo.mustache | 24 ++++++++-------- pom.xml | 1 + .../openapitools/client/model/SomeObj.java | 4 +-- .../model/AdditionalPropertiesAnyType.java | 4 +-- .../model/AdditionalPropertiesArray.java | 4 +-- .../model/AdditionalPropertiesBoolean.java | 4 +-- .../model/AdditionalPropertiesClass.java | 4 +-- .../model/AdditionalPropertiesInteger.java | 4 +-- .../model/AdditionalPropertiesNumber.java | 4 +-- .../model/AdditionalPropertiesObject.java | 4 +-- .../model/AdditionalPropertiesString.java | 4 +-- .../org/openapitools/client/model/Animal.java | 4 +-- .../model/ArrayOfArrayOfNumberOnly.java | 6 ++-- .../client/model/ArrayOfNumberOnly.java | 6 ++-- .../openapitools/client/model/ArrayTest.java | 10 +++---- .../org/openapitools/client/model/BigCat.java | 4 +-- .../client/model/BigCatAllOf.java | 4 +-- .../client/model/Capitalization.java | 4 +-- .../org/openapitools/client/model/Cat.java | 4 +-- .../openapitools/client/model/CatAllOf.java | 4 +-- .../openapitools/client/model/Category.java | 6 ++-- .../openapitools/client/model/ClassModel.java | 4 +-- .../org/openapitools/client/model/Client.java | 4 +-- .../org/openapitools/client/model/Dog.java | 4 +-- .../openapitools/client/model/DogAllOf.java | 4 +-- .../openapitools/client/model/EnumArrays.java | 6 ++-- .../openapitools/client/model/EnumTest.java | 6 ++-- .../client/model/FileSchemaTestClass.java | 4 +-- .../openapitools/client/model/FormatTest.java | 6 ++-- .../client/model/HasOnlyReadOnly.java | 4 +-- .../openapitools/client/model/MapTest.java | 4 +-- ...ropertiesAndAdditionalPropertiesClass.java | 4 +-- .../client/model/Model200Response.java | 4 +-- .../client/model/ModelApiResponse.java | 4 +-- .../openapitools/client/model/ModelFile.java | 4 +-- .../openapitools/client/model/ModelList.java | 4 +-- .../client/model/ModelReturn.java | 4 +-- .../org/openapitools/client/model/Name.java | 4 +-- .../openapitools/client/model/NumberOnly.java | 4 +-- .../org/openapitools/client/model/Order.java | 4 +-- .../client/model/OuterComposite.java | 4 +-- .../org/openapitools/client/model/Pet.java | 6 ++-- .../client/model/ReadOnlyFirst.java | 4 +-- .../client/model/SpecialModelName.java | 4 +-- .../org/openapitools/client/model/Tag.java | 4 +-- .../client/model/TypeHolderDefault.java | 6 ++-- .../client/model/TypeHolderExample.java | 6 ++-- .../org/openapitools/client/model/User.java | 4 +-- .../openapitools/client/model/XmlItem.java | 22 +++++++-------- .../openapitools/client/model/Category.java | 4 +-- .../client/model/ModelApiResponse.java | 4 +-- .../org/openapitools/client/model/Order.java | 4 +-- .../org/openapitools/client/model/Pet.java | 6 ++-- .../org/openapitools/client/model/Tag.java | 4 +-- .../org/openapitools/client/model/User.java | 4 +-- .../model/AdditionalPropertiesAnyType.java | 4 +-- .../model/AdditionalPropertiesArray.java | 4 +-- .../model/AdditionalPropertiesBoolean.java | 4 +-- .../model/AdditionalPropertiesClass.java | 4 +-- .../model/AdditionalPropertiesInteger.java | 4 +-- .../model/AdditionalPropertiesNumber.java | 4 +-- .../model/AdditionalPropertiesObject.java | 4 +-- .../model/AdditionalPropertiesString.java | 4 +-- .../org/openapitools/client/model/Animal.java | 4 +-- .../model/ArrayOfArrayOfNumberOnly.java | 6 ++-- .../client/model/ArrayOfNumberOnly.java | 6 ++-- .../openapitools/client/model/ArrayTest.java | 10 +++---- .../org/openapitools/client/model/BigCat.java | 4 +-- .../client/model/BigCatAllOf.java | 4 +-- .../client/model/Capitalization.java | 4 +-- .../org/openapitools/client/model/Cat.java | 4 +-- .../openapitools/client/model/CatAllOf.java | 4 +-- .../openapitools/client/model/Category.java | 6 ++-- .../openapitools/client/model/ClassModel.java | 4 +-- .../org/openapitools/client/model/Client.java | 4 +-- .../org/openapitools/client/model/Dog.java | 4 +-- .../openapitools/client/model/DogAllOf.java | 4 +-- .../openapitools/client/model/EnumArrays.java | 6 ++-- .../openapitools/client/model/EnumTest.java | 6 ++-- .../client/model/FileSchemaTestClass.java | 4 +-- .../openapitools/client/model/FormatTest.java | 6 ++-- .../client/model/HasOnlyReadOnly.java | 4 +-- .../openapitools/client/model/MapTest.java | 4 +-- ...ropertiesAndAdditionalPropertiesClass.java | 4 +-- .../client/model/Model200Response.java | 4 +-- .../client/model/ModelApiResponse.java | 4 +-- .../openapitools/client/model/ModelFile.java | 4 +-- .../openapitools/client/model/ModelList.java | 4 +-- .../client/model/ModelReturn.java | 4 +-- .../org/openapitools/client/model/Name.java | 4 +-- .../openapitools/client/model/NumberOnly.java | 4 +-- .../org/openapitools/client/model/Order.java | 4 +-- .../client/model/OuterComposite.java | 4 +-- .../org/openapitools/client/model/Pet.java | 6 ++-- .../client/model/ReadOnlyFirst.java | 4 +-- .../client/model/SpecialModelName.java | 4 +-- .../org/openapitools/client/model/Tag.java | 4 +-- .../client/model/TypeHolderDefault.java | 6 ++-- .../client/model/TypeHolderExample.java | 6 ++-- .../org/openapitools/client/model/User.java | 4 +-- .../openapitools/client/model/XmlItem.java | 22 +++++++-------- .../model/AdditionalPropertiesClass.java | 4 +-- .../org/openapitools/client/model/Animal.java | 4 +-- .../org/openapitools/client/model/Apple.java | 4 +-- .../openapitools/client/model/AppleReq.java | 6 ++-- .../model/ArrayOfArrayOfNumberOnly.java | 6 ++-- .../client/model/ArrayOfInlineAllOf.java | 6 ++-- ...InlineAllOfArrayAllofDogPropertyInner.java | 4 +-- ...eAllOfArrayAllofDogPropertyInnerAllOf.java | 4 +-- ...AllOfArrayAllofDogPropertyInnerAllOf1.java | 4 +-- .../client/model/ArrayOfNumberOnly.java | 6 ++-- .../openapitools/client/model/ArrayTest.java | 10 +++---- .../org/openapitools/client/model/Banana.java | 4 +-- .../openapitools/client/model/BananaReq.java | 4 +-- .../openapitools/client/model/BasquePig.java | 6 ++-- .../client/model/Capitalization.java | 4 +-- .../org/openapitools/client/model/Cat.java | 4 +-- .../openapitools/client/model/CatAllOf.java | 4 +-- .../openapitools/client/model/Category.java | 6 ++-- .../openapitools/client/model/ClassModel.java | 4 +-- .../org/openapitools/client/model/Client.java | 4 +-- .../client/model/ComplexQuadrilateral.java | 8 ++---- .../openapitools/client/model/DanishPig.java | 6 ++-- .../client/model/DeprecatedObject.java | 4 +-- .../org/openapitools/client/model/Dog.java | 4 +-- .../openapitools/client/model/DogAllOf.java | 4 +-- .../openapitools/client/model/Drawing.java | 4 +-- .../openapitools/client/model/EnumArrays.java | 6 ++-- .../client/model/EnumStringDiscriminator.java | 4 +-- .../openapitools/client/model/EnumTest.java | 6 ++-- .../client/model/EquilateralTriangle.java | 8 ++---- .../client/model/FileSchemaTestClass.java | 4 +-- .../org/openapitools/client/model/Foo.java | 4 +-- .../client/model/FooGetDefaultResponse.java | 4 +-- .../openapitools/client/model/FormatTest.java | 6 ++-- .../client/model/GrandparentAnimal.java | 4 +-- .../client/model/HasOnlyReadOnly.java | 4 +-- .../client/model/HealthCheckResult.java | 4 +-- .../client/model/IsoscelesTriangle.java | 8 ++---- .../openapitools/client/model/MapTest.java | 4 +-- ...ropertiesAndAdditionalPropertiesClass.java | 4 +-- .../client/model/Model200Response.java | 4 +-- .../client/model/ModelApiResponse.java | 4 +-- .../openapitools/client/model/ModelFile.java | 4 +-- .../openapitools/client/model/ModelList.java | 4 +-- .../client/model/ModelReturn.java | 4 +-- .../org/openapitools/client/model/Name.java | 4 +-- .../client/model/NullableClass.java | 10 +++---- .../openapitools/client/model/NumberOnly.java | 4 +-- .../model/ObjectWithDeprecatedFields.java | 6 ++-- .../org/openapitools/client/model/Order.java | 4 +-- .../client/model/OuterComposite.java | 4 +-- .../openapitools/client/model/ParentPet.java | 4 +-- .../org/openapitools/client/model/Pet.java | 6 ++-- .../client/model/PetWithRequiredTags.java | 28 ++++++++----------- .../client/model/QuadrilateralInterface.java | 6 ++-- .../client/model/ReadOnlyFirst.java | 4 +-- .../client/model/ScaleneTriangle.java | 8 ++---- .../client/model/ShapeInterface.java | 6 ++-- .../client/model/SimpleQuadrilateral.java | 8 ++---- .../client/model/SpecialModelName.java | 4 +-- .../org/openapitools/client/model/Tag.java | 4 +-- .../client/model/TriangleInterface.java | 6 ++-- .../org/openapitools/client/model/User.java | 4 +-- .../org/openapitools/client/model/Whale.java | 6 ++-- .../org/openapitools/client/model/Zebra.java | 6 ++-- .../org/openapitools/client/JSONTest.java | 14 ++++++++++ 168 files changed, 276 insertions(+), 598 deletions(-) diff --git a/.github/workflows/samples-java-client-jdk11.yaml b/.github/workflows/samples-java-client-jdk11.yaml index 6360552b106f..2c2cda527eab 100644 --- a/.github/workflows/samples-java-client-jdk11.yaml +++ b/.github/workflows/samples-java-client-jdk11.yaml @@ -4,7 +4,6 @@ on: push: paths: - 'samples/client/petstore/java/**' - - 'samples/client/petstore/java-micronaut-client/**' - samples/client/petstore/jaxrs-cxf-client/** - samples/client/petstore/java-micronaut-client/** - samples/openapi3/client/petstore/java/jersey2-java8-special-characters/** @@ -12,7 +11,6 @@ on: pull_request: paths: - 'samples/client/petstore/java/**' - - 'samples/client/petstore/java-micronaut-client/**' - samples/client/petstore/jaxrs-cxf-client/** - samples/client/petstore/java-micronaut-client/** - samples/openapi3/client/petstore/java/jersey2-java8-special-characters/** @@ -26,7 +24,6 @@ jobs: matrix: sample: # clients - - samples/client/petstore/java-micronaut-client - samples/client/petstore/jaxrs-cxf-client - samples/client/petstore/java/native - samples/client/petstore/java/native-async diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache index 48962a371e2f..b2d6a1942085 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache @@ -436,9 +436,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if ({{classname}}.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!{{classname}}.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString())); } } @@ -469,7 +467,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{#vars}} {{#isArray}} {{#items.isModel}} - {{#isRequired}} + {{#required}} // ensure the json data is an array if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); @@ -480,8 +478,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens for (int i = 0; i < jsonArray{{name}}.size(); i++) { {{{items.dataType}}}.validateJsonObject(jsonArray{{name}}.get(i).getAsJsonObject()); }; - {{/isRequired}} - {{^isRequired}} + {{/required}} + {{^required}} if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); if (jsonArray{{name}} != null) { @@ -496,32 +494,32 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens }; } } - {{/isRequired}} + {{/required}} {{/items.isModel}} {{^items.isModel}} // ensure the json data is an array - if ({{^isRequired}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/isRequired}}!jsonObj.get("{{{baseName}}}").isJsonArray()) { + if ({{#required}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/required}}!jsonObj.get("{{{baseName}}}").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); } {{/items.isModel}} {{/isArray}} {{^isContainer}} {{#isString}} - if ({{^isRequired}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/isRequired}}!jsonObj.get("{{{baseName}}}").isJsonPrimitive()) { + if ({{^required}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/required}}!jsonObj.get("{{{baseName}}}").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); } {{/isString}} {{#isModel}} - {{#isRequired}} + {{#required}} // validate the required field `{{{baseName}}}` {{{dataType}}}.validateJsonObject(jsonObj.getAsJsonObject("{{{baseName}}}")); - {{/isRequired}} - {{^isRequired}} + {{/required}} + {{^required}} // validate the optional field `{{{baseName}}}` if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { {{{dataType}}}.validateJsonObject(jsonObj.getAsJsonObject("{{{baseName}}}")); } - {{/isRequired}} + {{/required}} {{/isModel}} {{/isContainer}} {{/vars}} diff --git a/pom.xml b/pom.xml index 86be53812d30..54b36bd4bcee 100644 --- a/pom.xml +++ b/pom.xml @@ -1271,6 +1271,7 @@ samples/client/petstore/java/jersey3 samples/client/others/java/okhttp-gson-streaming samples/client/petstore/java/okhttp-gson + samples/client/petstore/java-micronaut-client diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java index ad8fe4f7230c..52b25858f944 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SomeObj.java @@ -303,9 +303,7 @@ public class SomeObj { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (SomeObj.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!SomeObj.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in SomeObj is not found in the empty JSON string", SomeObj.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 9af5a1cf894f..f0821e6d2202 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -138,9 +138,7 @@ public class AdditionalPropertiesAnyType { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesAnyType.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesAnyType.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 88548c181c5d..598684e4263d 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -139,9 +139,7 @@ public class AdditionalPropertiesArray { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesArray.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesArray.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesArray is not found in the empty JSON string", AdditionalPropertiesArray.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index ce558fd4c809..c3b5720d76f0 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -138,9 +138,7 @@ public class AdditionalPropertiesBoolean { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesBoolean.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesBoolean.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesBoolean is not found in the empty JSON string", AdditionalPropertiesBoolean.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index a214e0384fef..dd6a62ee0c22 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -506,9 +506,7 @@ public class AdditionalPropertiesClass { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index fcec9d603f1f..ee165d80b927 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -138,9 +138,7 @@ public class AdditionalPropertiesInteger { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesInteger.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesInteger.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesInteger is not found in the empty JSON string", AdditionalPropertiesInteger.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index 1bef7f517b15..717fbfada160 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -139,9 +139,7 @@ public class AdditionalPropertiesNumber { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesNumber.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesNumber is not found in the empty JSON string", AdditionalPropertiesNumber.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index 60c2e6438350..ab3903887bbb 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -139,9 +139,7 @@ public class AdditionalPropertiesObject { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesObject.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index 016e779e3373..8e202f0b3c1a 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -138,9 +138,7 @@ public class AdditionalPropertiesString { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesString.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesString.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesString is not found in the empty JSON string", AdditionalPropertiesString.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java index b045d85de95e..6544aafe659d 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Animal.java @@ -173,9 +173,7 @@ public class Animal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Animal.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Animal.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Animal is not found in the empty JSON string", Animal.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 8ff0983c4983..bb2bc0b8eb57 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -149,9 +149,7 @@ public class ArrayOfArrayOfNumberOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); } } @@ -164,7 +162,7 @@ public class ArrayOfArrayOfNumberOnly { } } // ensure the json data is an array - if ((jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull()) && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + if (!jsonObj.get("ArrayArrayNumber").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index e6ee46bae846..ead804322868 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -149,9 +149,7 @@ public class ArrayOfNumberOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); } } @@ -164,7 +162,7 @@ public class ArrayOfNumberOnly { } } // ensure the json data is an array - if ((jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull()) && !jsonObj.get("ArrayNumber").isJsonArray()) { + if (!jsonObj.get("ArrayNumber").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java index 8e14450363c8..fcbe15187774 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -225,9 +225,7 @@ public class ArrayTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); } } @@ -240,15 +238,15 @@ public class ArrayTest { } } // ensure the json data is an array - if ((jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull()) && !jsonObj.get("array_of_string").isJsonArray()) { + if (!jsonObj.get("array_of_string").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonNull()) && !jsonObj.get("array_array_of_integer").isJsonArray()) { + if (!jsonObj.get("array_array_of_integer").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonNull()) && !jsonObj.get("array_array_of_model").isJsonArray()) { + if (!jsonObj.get("array_array_of_model").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java index b5cf10ea0475..e1891f743366 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCat.java @@ -197,9 +197,7 @@ public class BigCat extends Cat { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (BigCat.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!BigCat.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in BigCat is not found in the empty JSON string", BigCat.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 4ac4ffce8f76..dfd9b1cfa8d4 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -189,9 +189,7 @@ public class BigCatAllOf { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (BigCatAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!BigCatAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in BigCatAllOf is not found in the empty JSON string", BigCatAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java index 7c1af423590e..a21f9ddcd6bc 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Capitalization.java @@ -288,9 +288,7 @@ public class Capitalization { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Capitalization.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Capitalization.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java index 3195b2aad1dc..d264d6a7af28 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Cat.java @@ -146,9 +146,7 @@ public class Cat extends Animal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Cat.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Cat.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Cat is not found in the empty JSON string", Cat.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java index 54dddab6e513..f870e77805bc 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -138,9 +138,7 @@ public class CatAllOf { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (CatAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!CatAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in CatAllOf is not found in the empty JSON string", CatAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java index 2cd0c1298b1e..c2ccf6ae9114 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Category.java @@ -169,9 +169,7 @@ public class Category { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Category.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); } } @@ -190,7 +188,7 @@ public class Category { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java index 504afaae0137..77e036027c1d 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ClassModel.java @@ -139,9 +139,7 @@ public class ClassModel { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ClassModel.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ClassModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java index cf7d6ce224ba..feac9e3039d1 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Client.java @@ -138,9 +138,7 @@ public class Client { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Client.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Client.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java index 2d2d8e4ecd09..849e96210e25 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Dog.java @@ -145,9 +145,7 @@ public class Dog extends Animal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Dog.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Dog.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java index 4cf8b6b7f169..a061ea3c4423 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -138,9 +138,7 @@ public class DogAllOf { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (DogAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!DogAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in DogAllOf is not found in the empty JSON string", DogAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java index 106e7a6a22a6..31615796fbb5 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -272,9 +272,7 @@ public class EnumArrays { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EnumArrays.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EnumArrays.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); } } @@ -290,7 +288,7 @@ public class EnumArrays { throw new IllegalArgumentException(String.format("Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull()) && !jsonObj.get("array_enum").isJsonArray()) { + if (!jsonObj.get("array_enum").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java index 7a09e5e8e9d9..7d1cf66794e6 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/EnumTest.java @@ -452,9 +452,7 @@ public class EnumTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EnumTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EnumTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString())); } } @@ -476,7 +474,7 @@ public class EnumTest { if ((jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) && !jsonObj.get("enum_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); } - if ((jsonObj.get("enum_string_required") != null && !jsonObj.get("enum_string_required").isJsonNull()) && !jsonObj.get("enum_string_required").isJsonPrimitive()) { + if (!jsonObj.get("enum_string_required").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 0bbab2a860af..4b1c10290b0e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -179,9 +179,7 @@ public class FileSchemaTestClass { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (FileSchemaTestClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!FileSchemaTestClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java index daac9d6acbec..06d9058cdb46 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/FormatTest.java @@ -547,9 +547,7 @@ public class FormatTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (FormatTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!FormatTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString())); } } @@ -574,7 +572,7 @@ public class FormatTest { if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); } - if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + if (!jsonObj.get("password").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index a1f7bd66fadf..ab2d43afecdd 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -160,9 +160,7 @@ public class HasOnlyReadOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java index 55286564b014..9612c2799af9 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MapTest.java @@ -309,9 +309,7 @@ public class MapTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (MapTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!MapTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 2dac3ac1cfd7..b8969e5d78fe 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -211,9 +211,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java index 20cb35b6c6ca..62479b4171e2 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Model200Response.java @@ -169,9 +169,7 @@ public class Model200Response { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Model200Response.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Model200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 82a7caa239b2..cecce9bf053c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -198,9 +198,7 @@ public class ModelApiResponse { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelApiResponse.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java index a149a7524cfa..0271d19ec3b9 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelFile.java @@ -139,9 +139,7 @@ public class ModelFile { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelFile.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java index 408dae41ef78..ab6232a79b86 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelList.java @@ -138,9 +138,7 @@ public class ModelList { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelList.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelList.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java index ace1d23a700c..9412d6d09281 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -139,9 +139,7 @@ public class ModelReturn { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelReturn.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelReturn.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java index 7da943b57b1e..2db548e4bd94 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Name.java @@ -222,9 +222,7 @@ public class Name { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Name.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Name.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java index d464a1b8e5af..6d8fcba7d9b3 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -139,9 +139,7 @@ public class NumberOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (NumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!NumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java index 788644393f52..cdf57447250c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Order.java @@ -338,9 +338,7 @@ public class Order { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Order.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java index d7d6b1a9195d..b0f22f90982e 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -199,9 +199,7 @@ public class OuterComposite { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (OuterComposite.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!OuterComposite.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java index 72bb820f87ac..0f91e98f35ea 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Pet.java @@ -358,9 +358,7 @@ public class Pet { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Pet.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); } } @@ -383,7 +381,7 @@ public class Pet { if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 033edb388a64..5a8b18873dcc 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -167,9 +167,7 @@ public class ReadOnlyFirst { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ReadOnlyFirst.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ReadOnlyFirst.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java index 12dbe19c7bf5..bdacd2ce1809 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -138,9 +138,7 @@ public class SpecialModelName { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (SpecialModelName.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!SpecialModelName.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java index 447018646985..03b119d303e9 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/Tag.java @@ -168,9 +168,7 @@ public class Tag { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Tag.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 2f6cf4cd3f48..8966c7136796 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -271,9 +271,7 @@ public class TypeHolderDefault { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (TypeHolderDefault.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!TypeHolderDefault.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderDefault is not found in the empty JSON string", TypeHolderDefault.openapiRequiredFields.toString())); } } @@ -292,7 +290,7 @@ public class TypeHolderDefault { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonNull()) && !jsonObj.get("string_item").isJsonPrimitive()) { + if (!jsonObj.get("string_item").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java index 15a6cda20345..5023112e2a7c 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -302,9 +302,7 @@ public class TypeHolderExample { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (TypeHolderExample.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!TypeHolderExample.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderExample is not found in the empty JSON string", TypeHolderExample.openapiRequiredFields.toString())); } } @@ -323,7 +321,7 @@ public class TypeHolderExample { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonNull()) && !jsonObj.get("string_item").isJsonPrimitive()) { + if (!jsonObj.get("string_item").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java index 0fd383880415..d07c822002af 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/User.java @@ -348,9 +348,7 @@ public class User { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (User.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java index 1eedb2b0454b..c7af7a8dcd2f 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/model/XmlItem.java @@ -1053,9 +1053,7 @@ public class XmlItem { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (XmlItem.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!XmlItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString())); } } @@ -1071,51 +1069,51 @@ public class XmlItem { throw new IllegalArgumentException(String.format("Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("wrapped_array") != null && !jsonObj.get("wrapped_array").isJsonNull()) && !jsonObj.get("wrapped_array").isJsonArray()) { + if (!jsonObj.get("wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("wrapped_array").toString())); } if ((jsonObj.get("name_string") != null && !jsonObj.get("name_string").isJsonNull()) && !jsonObj.get("name_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("name_array") != null && !jsonObj.get("name_array").isJsonNull()) && !jsonObj.get("name_array").isJsonArray()) { + if (!jsonObj.get("name_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `name_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("name_wrapped_array") != null && !jsonObj.get("name_wrapped_array").isJsonNull()) && !jsonObj.get("name_wrapped_array").isJsonArray()) { + if (!jsonObj.get("name_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `name_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_wrapped_array").toString())); } if ((jsonObj.get("prefix_string") != null && !jsonObj.get("prefix_string").isJsonNull()) && !jsonObj.get("prefix_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_array") != null && !jsonObj.get("prefix_array").isJsonNull()) && !jsonObj.get("prefix_array").isJsonArray()) { + if (!jsonObj.get("prefix_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_wrapped_array") != null && !jsonObj.get("prefix_wrapped_array").isJsonNull()) && !jsonObj.get("prefix_wrapped_array").isJsonArray()) { + if (!jsonObj.get("prefix_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_wrapped_array").toString())); } if ((jsonObj.get("namespace_string") != null && !jsonObj.get("namespace_string").isJsonNull()) && !jsonObj.get("namespace_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `namespace_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("namespace_array") != null && !jsonObj.get("namespace_array").isJsonNull()) && !jsonObj.get("namespace_array").isJsonArray()) { + if (!jsonObj.get("namespace_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `namespace_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("namespace_wrapped_array") != null && !jsonObj.get("namespace_wrapped_array").isJsonNull()) && !jsonObj.get("namespace_wrapped_array").isJsonArray()) { + if (!jsonObj.get("namespace_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `namespace_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_wrapped_array").toString())); } if ((jsonObj.get("prefix_ns_string") != null && !jsonObj.get("prefix_ns_string").isJsonNull()) && !jsonObj.get("prefix_ns_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_ns_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_ns_array") != null && !jsonObj.get("prefix_ns_array").isJsonNull()) && !jsonObj.get("prefix_ns_array").isJsonArray()) { + if (!jsonObj.get("prefix_ns_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_ns_wrapped_array") != null && !jsonObj.get("prefix_ns_wrapped_array").isJsonNull()) && !jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { + if (!jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_wrapped_array").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Category.java index 9c05251eb221..ed709beb2457 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Category.java @@ -206,9 +206,7 @@ public class Category { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Category.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java index b1a13a2b6f0b..48e893219d44 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -236,9 +236,7 @@ public class ModelApiResponse { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelApiResponse.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Order.java index 56a801cdfae5..5e9f5befa28b 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Order.java @@ -376,9 +376,7 @@ public class Order { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Order.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Pet.java index d047476f68e1..e1679b066567 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Pet.java @@ -396,9 +396,7 @@ public class Pet { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Pet.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); } } @@ -413,7 +411,7 @@ public class Pet { if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Tag.java index 3f1690bbd020..989a4742d236 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/Tag.java @@ -206,9 +206,7 @@ public class Tag { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Tag.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/User.java index 569f1b63a8ab..0fc8d804f705 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/model/User.java @@ -386,9 +386,7 @@ public class User { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (User.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java index 8fc16c8d607f..8d7756779d98 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -161,9 +161,7 @@ public class AdditionalPropertiesAnyType implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesAnyType.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesAnyType.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java index 479ee5dab641..b4eaa1749829 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -162,9 +162,7 @@ public class AdditionalPropertiesArray implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesArray.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesArray.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesArray is not found in the empty JSON string", AdditionalPropertiesArray.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java index 209dbc95bb85..b1e6978f33cc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -161,9 +161,7 @@ public class AdditionalPropertiesBoolean implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesBoolean.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesBoolean.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesBoolean is not found in the empty JSON string", AdditionalPropertiesBoolean.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index cdd8c9515e4b..d80117804309 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -549,9 +549,7 @@ public class AdditionalPropertiesClass implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java index f39ca94dec00..590723e883c4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -161,9 +161,7 @@ public class AdditionalPropertiesInteger implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesInteger.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesInteger.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesInteger is not found in the empty JSON string", AdditionalPropertiesInteger.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java index a637cf571a56..f505b4ac8c68 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -162,9 +162,7 @@ public class AdditionalPropertiesNumber implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesNumber.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesNumber is not found in the empty JSON string", AdditionalPropertiesNumber.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java index e3166633d278..84557a8dc12f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -162,9 +162,7 @@ public class AdditionalPropertiesObject implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesObject.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java index c13e9c9a52ce..a2043e6007da 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -161,9 +161,7 @@ public class AdditionalPropertiesString implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesString.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesString.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesString is not found in the empty JSON string", AdditionalPropertiesString.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java index bf061992bfea..f5664798e130 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java @@ -198,9 +198,7 @@ public class Animal implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Animal.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Animal.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Animal is not found in the empty JSON string", Animal.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 61aa49378a72..7e094261c25a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -172,9 +172,7 @@ public class ArrayOfArrayOfNumberOnly implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); } } @@ -187,7 +185,7 @@ public class ArrayOfArrayOfNumberOnly implements Parcelable { } } // ensure the json data is an array - if ((jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull()) && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + if (!jsonObj.get("ArrayArrayNumber").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 2f3d312851d3..9b1111fdd99d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -172,9 +172,7 @@ public class ArrayOfNumberOnly implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); } } @@ -187,7 +185,7 @@ public class ArrayOfNumberOnly implements Parcelable { } } // ensure the json data is an array - if ((jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull()) && !jsonObj.get("ArrayNumber").isJsonArray()) { + if (!jsonObj.get("ArrayNumber").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java index e64f8855a265..15d241225352 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -252,9 +252,7 @@ public class ArrayTest implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); } } @@ -267,15 +265,15 @@ public class ArrayTest implements Parcelable { } } // ensure the json data is an array - if ((jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull()) && !jsonObj.get("array_of_string").isJsonArray()) { + if (!jsonObj.get("array_of_string").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonNull()) && !jsonObj.get("array_array_of_integer").isJsonArray()) { + if (!jsonObj.get("array_array_of_integer").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonNull()) && !jsonObj.get("array_array_of_model").isJsonArray()) { + if (!jsonObj.get("array_array_of_model").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java index 1ae3d488cb2d..8852815c3c16 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java @@ -223,9 +223,7 @@ public class BigCat extends Cat implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (BigCat.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!BigCat.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in BigCat is not found in the empty JSON string", BigCat.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java index 2d103893f868..42500992c6ee 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -212,9 +212,7 @@ public class BigCatAllOf implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (BigCatAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!BigCatAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in BigCatAllOf is not found in the empty JSON string", BigCatAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java index d25de409590b..af3f7f2e9cc0 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -321,9 +321,7 @@ public class Capitalization implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Capitalization.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Capitalization.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java index 1940146df018..076ede1bd89f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java @@ -172,9 +172,7 @@ public class Cat extends Animal implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Cat.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Cat.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Cat is not found in the empty JSON string", Cat.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java index 6bead8465aa1..3cc84ae9af32 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -161,9 +161,7 @@ public class CatAllOf implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (CatAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!CatAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in CatAllOf is not found in the empty JSON string", CatAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index 1212def7d17c..1751bab19f3c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -194,9 +194,7 @@ public class Category implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Category.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); } } @@ -215,7 +213,7 @@ public class Category implements Parcelable { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java index aa398d68a38c..4a9de3cac461 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -162,9 +162,7 @@ public class ClassModel implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ClassModel.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ClassModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java index a4ff6be534a5..ed7e83da8e02 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -161,9 +161,7 @@ public class Client implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Client.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Client.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java index 68002b64d538..2d6baf6963f1 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java @@ -171,9 +171,7 @@ public class Dog extends Animal implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Dog.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Dog.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java index 03cfa9812aad..78709e104f91 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -161,9 +161,7 @@ public class DogAllOf implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (DogAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!DogAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in DogAllOf is not found in the empty JSON string", DogAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index d8ffd038ae82..af5771461cec 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -297,9 +297,7 @@ public class EnumArrays implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EnumArrays.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EnumArrays.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); } } @@ -315,7 +313,7 @@ public class EnumArrays implements Parcelable { throw new IllegalArgumentException(String.format("Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull()) && !jsonObj.get("array_enum").isJsonArray()) { + if (!jsonObj.get("array_enum").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java index 4d8c74b0f017..8124606cef27 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -483,9 +483,7 @@ public class EnumTest implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EnumTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EnumTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString())); } } @@ -507,7 +505,7 @@ public class EnumTest implements Parcelable { if ((jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) && !jsonObj.get("enum_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); } - if ((jsonObj.get("enum_string_required") != null && !jsonObj.get("enum_string_required").isJsonNull()) && !jsonObj.get("enum_string_required").isJsonPrimitive()) { + if (!jsonObj.get("enum_string_required").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index b419b429d8b0..71b55845f8d3 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -204,9 +204,7 @@ public class FileSchemaTestClass implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (FileSchemaTestClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!FileSchemaTestClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java index 00dfe2efd2a0..ed3d5493509d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -596,9 +596,7 @@ public class FormatTest implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (FormatTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!FormatTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString())); } } @@ -623,7 +621,7 @@ public class FormatTest implements Parcelable { if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); } - if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + if (!jsonObj.get("password").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index df6acd028415..c6977ace6ea6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -185,9 +185,7 @@ public class HasOnlyReadOnly implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java index a3613e4d2f67..348d37b8418e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -338,9 +338,7 @@ public class MapTest implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (MapTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!MapTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a9f303e317a6..9402576b34c7 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -238,9 +238,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java index 7be55633abbb..27b40d32d52e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -194,9 +194,7 @@ public class Model200Response implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Model200Response.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Model200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java index d2735fdc23cf..47538e4ef166 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -225,9 +225,7 @@ public class ModelApiResponse implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelApiResponse.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java index 7a28c4ed1350..760aabb64b32 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelFile.java @@ -162,9 +162,7 @@ public class ModelFile implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelFile.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java index 400a405978aa..3e9aa0ad1c7a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelList.java @@ -161,9 +161,7 @@ public class ModelList implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelList.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelList.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java index ff0935edd1c0..45ca478e7af6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -162,9 +162,7 @@ public class ModelReturn implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelReturn.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelReturn.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java index 8d71695c2531..05c563c3ea61 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -251,9 +251,7 @@ public class Name implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Name.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Name.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java index eb300bfda3f8..a0281d352747 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -162,9 +162,7 @@ public class NumberOnly implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (NumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!NumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java index c78034d9f77a..f18f79fd9e38 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -371,9 +371,7 @@ public class Order implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Order.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java index 121e3067a21a..5199ecbf4ef6 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -226,9 +226,7 @@ public class OuterComposite implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (OuterComposite.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!OuterComposite.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index 6e10e2f4ad6a..5b88f2f53724 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -391,9 +391,7 @@ public class Pet implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Pet.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); } } @@ -416,7 +414,7 @@ public class Pet implements Parcelable { if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 729894c2fce8..e326374f6954 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -192,9 +192,7 @@ public class ReadOnlyFirst implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ReadOnlyFirst.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ReadOnlyFirst.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java index b7d945c7ee7d..17e08f6372bb 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -161,9 +161,7 @@ public class SpecialModelName implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (SpecialModelName.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!SpecialModelName.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java index 3a6d180fac44..520daa2fdeb1 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -193,9 +193,7 @@ public class Tag implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Tag.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index ade444361f72..b20530e83d17 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -302,9 +302,7 @@ public class TypeHolderDefault implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (TypeHolderDefault.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!TypeHolderDefault.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderDefault is not found in the empty JSON string", TypeHolderDefault.openapiRequiredFields.toString())); } } @@ -323,7 +321,7 @@ public class TypeHolderDefault implements Parcelable { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonNull()) && !jsonObj.get("string_item").isJsonPrimitive()) { + if (!jsonObj.get("string_item").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java index a7ebefdbf09d..57c2e37c43f9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -335,9 +335,7 @@ public class TypeHolderExample implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (TypeHolderExample.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!TypeHolderExample.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in TypeHolderExample is not found in the empty JSON string", TypeHolderExample.openapiRequiredFields.toString())); } } @@ -356,7 +354,7 @@ public class TypeHolderExample implements Parcelable { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonNull()) && !jsonObj.get("string_item").isJsonPrimitive()) { + if (!jsonObj.get("string_item").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `string_item` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_item").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java index c0ab58fb5f07..41a3c81b01a1 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -385,9 +385,7 @@ public class User implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (User.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java index 98b7f3896a1f..218d9ac3247a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/XmlItem.java @@ -1132,9 +1132,7 @@ public class XmlItem implements Parcelable { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (XmlItem.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!XmlItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in XmlItem is not found in the empty JSON string", XmlItem.openapiRequiredFields.toString())); } } @@ -1150,51 +1148,51 @@ public class XmlItem implements Parcelable { throw new IllegalArgumentException(String.format("Expected the field `attribute_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attribute_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("wrapped_array") != null && !jsonObj.get("wrapped_array").isJsonNull()) && !jsonObj.get("wrapped_array").isJsonArray()) { + if (!jsonObj.get("wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("wrapped_array").toString())); } if ((jsonObj.get("name_string") != null && !jsonObj.get("name_string").isJsonNull()) && !jsonObj.get("name_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("name_array") != null && !jsonObj.get("name_array").isJsonNull()) && !jsonObj.get("name_array").isJsonArray()) { + if (!jsonObj.get("name_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `name_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("name_wrapped_array") != null && !jsonObj.get("name_wrapped_array").isJsonNull()) && !jsonObj.get("name_wrapped_array").isJsonArray()) { + if (!jsonObj.get("name_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `name_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("name_wrapped_array").toString())); } if ((jsonObj.get("prefix_string") != null && !jsonObj.get("prefix_string").isJsonNull()) && !jsonObj.get("prefix_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_array") != null && !jsonObj.get("prefix_array").isJsonNull()) && !jsonObj.get("prefix_array").isJsonArray()) { + if (!jsonObj.get("prefix_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_wrapped_array") != null && !jsonObj.get("prefix_wrapped_array").isJsonNull()) && !jsonObj.get("prefix_wrapped_array").isJsonArray()) { + if (!jsonObj.get("prefix_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_wrapped_array").toString())); } if ((jsonObj.get("namespace_string") != null && !jsonObj.get("namespace_string").isJsonNull()) && !jsonObj.get("namespace_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `namespace_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("namespace_array") != null && !jsonObj.get("namespace_array").isJsonNull()) && !jsonObj.get("namespace_array").isJsonArray()) { + if (!jsonObj.get("namespace_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `namespace_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("namespace_wrapped_array") != null && !jsonObj.get("namespace_wrapped_array").isJsonNull()) && !jsonObj.get("namespace_wrapped_array").isJsonArray()) { + if (!jsonObj.get("namespace_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `namespace_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("namespace_wrapped_array").toString())); } if ((jsonObj.get("prefix_ns_string") != null && !jsonObj.get("prefix_ns_string").isJsonNull()) && !jsonObj.get("prefix_ns_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prefix_ns_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_ns_array") != null && !jsonObj.get("prefix_ns_array").isJsonNull()) && !jsonObj.get("prefix_ns_array").isJsonArray()) { + if (!jsonObj.get("prefix_ns_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_array").toString())); } // ensure the json data is an array - if ((jsonObj.get("prefix_ns_wrapped_array") != null && !jsonObj.get("prefix_ns_wrapped_array").isJsonNull()) && !jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { + if (!jsonObj.get("prefix_ns_wrapped_array").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `prefix_ns_wrapped_array` to be an array in the JSON string but got `%s`", jsonObj.get("prefix_ns_wrapped_array").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 56968e724e10..927b23386e9c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -431,9 +431,7 @@ public class AdditionalPropertiesClass { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesClass is not found in the empty JSON string", AdditionalPropertiesClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java index f8d4a801ceb1..e1d94b6362c2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java @@ -209,9 +209,7 @@ public class Animal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Animal.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Animal.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Animal is not found in the empty JSON string", Animal.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java index fe789b54a432..9183df38a0cc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Apple.java @@ -205,9 +205,7 @@ public class Apple { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Apple.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Apple.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Apple is not found in the empty JSON string", Apple.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java index ec84d96acb6f..dd30c95c03f6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AppleReq.java @@ -169,9 +169,7 @@ public class AppleReq { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (AppleReq.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!AppleReq.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in AppleReq is not found in the empty JSON string", AppleReq.openapiRequiredFields.toString())); } } @@ -190,7 +188,7 @@ public class AppleReq { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("cultivar") != null && !jsonObj.get("cultivar").isJsonNull()) && !jsonObj.get("cultivar").isJsonPrimitive()) { + if (!jsonObj.get("cultivar").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `cultivar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cultivar").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 662b4ac9f1e9..ca1cf1d38782 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -186,14 +186,12 @@ public class ArrayOfArrayOfNumberOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfArrayOfNumberOnly is not found in the empty JSON string", ArrayOfArrayOfNumberOnly.openapiRequiredFields.toString())); } } // ensure the json data is an array - if ((jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull()) && !jsonObj.get("ArrayArrayNumber").isJsonArray()) { + if (!jsonObj.get("ArrayArrayNumber").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `ArrayArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayArrayNumber").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java index 7c98c7506193..267f4099282f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOf.java @@ -247,9 +247,7 @@ public class ArrayOfInlineAllOf { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfInlineAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfInlineAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfInlineAllOf is not found in the empty JSON string", ArrayOfInlineAllOf.openapiRequiredFields.toString())); } } @@ -260,7 +258,7 @@ public class ArrayOfInlineAllOf { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } if (jsonObj.get("array_allof_dog_property") != null && !jsonObj.get("array_allof_dog_property").isJsonNull()) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java index 42f39477c78d..343155380bcb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInner.java @@ -205,9 +205,7 @@ public class ArrayOfInlineAllOfArrayAllofDogPropertyInner { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfInlineAllOfArrayAllofDogPropertyInner.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfInlineAllOfArrayAllofDogPropertyInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfInlineAllOfArrayAllofDogPropertyInner is not found in the empty JSON string", ArrayOfInlineAllOfArrayAllofDogPropertyInner.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf.java index e5d997a8bfc7..c03822891879 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf.java @@ -175,9 +175,7 @@ public class ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf is not found in the empty JSON string", ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1.java index a98e855d5480..ca9607ca9ce2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1.java @@ -175,9 +175,7 @@ public class ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1 { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1 is not found in the empty JSON string", ArrayOfInlineAllOfArrayAllofDogPropertyInnerAllOf1.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 21dab1c6f9b9..7bdd9ad63659 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -186,14 +186,12 @@ public class ArrayOfNumberOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayOfNumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayOfNumberOnly is not found in the empty JSON string", ArrayOfNumberOnly.openapiRequiredFields.toString())); } } // ensure the json data is an array - if ((jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull()) && !jsonObj.get("ArrayNumber").isJsonArray()) { + if (!jsonObj.get("ArrayNumber").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `ArrayNumber` to be an array in the JSON string but got `%s`", jsonObj.get("ArrayNumber").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java index 3e4c2999c0a3..fa4e62ac1e8a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -262,22 +262,20 @@ public class ArrayTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ArrayTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ArrayTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayTest is not found in the empty JSON string", ArrayTest.openapiRequiredFields.toString())); } } // ensure the json data is an array - if ((jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull()) && !jsonObj.get("array_of_string").isJsonArray()) { + if (!jsonObj.get("array_of_string").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_of_string` to be an array in the JSON string but got `%s`", jsonObj.get("array_of_string").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonNull()) && !jsonObj.get("array_array_of_integer").isJsonArray()) { + if (!jsonObj.get("array_array_of_integer").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_array_of_integer` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_integer").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonNull()) && !jsonObj.get("array_array_of_model").isJsonArray()) { + if (!jsonObj.get("array_array_of_model").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_array_of_model` to be an array in the JSON string but got `%s`", jsonObj.get("array_array_of_model").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Banana.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Banana.java index af702cf4d50d..409f56dc5fb8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Banana.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Banana.java @@ -176,9 +176,7 @@ public class Banana { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Banana.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Banana.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Banana is not found in the empty JSON string", Banana.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java index f7f4ba9c0fad..877f598954a7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BananaReq.java @@ -170,9 +170,7 @@ public class BananaReq { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (BananaReq.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!BananaReq.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in BananaReq is not found in the empty JSON string", BananaReq.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java index fe59e6ecabdb..ed5f880e3b8b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BasquePig.java @@ -176,9 +176,7 @@ public class BasquePig { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (BasquePig.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!BasquePig.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in BasquePig is not found in the empty JSON string", BasquePig.openapiRequiredFields.toString())); } } @@ -189,7 +187,7 @@ public class BasquePig { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("className") != null && !jsonObj.get("className").isJsonNull()) && !jsonObj.get("className").isJsonPrimitive()) { + if (!jsonObj.get("className").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java index ae3bdcf6a99e..a7b48934c349 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java @@ -325,9 +325,7 @@ public class Capitalization { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Capitalization.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Capitalization.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Capitalization is not found in the empty JSON string", Capitalization.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java index a420ce22d9fe..a517389ddc17 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java @@ -182,9 +182,7 @@ public class Cat extends Animal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Cat.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Cat.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Cat is not found in the empty JSON string", Cat.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java index 3ff395a28529..09ce3c2ef7c5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -175,9 +175,7 @@ public class CatAllOf { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (CatAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!CatAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in CatAllOf is not found in the empty JSON string", CatAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java index a9f834c13c7a..77d617720755 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java @@ -206,9 +206,7 @@ public class Category { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Category.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); } } @@ -219,7 +217,7 @@ public class Category { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java index 27f75c9cdafd..0f8b166129db 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java @@ -176,9 +176,7 @@ public class ClassModel { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ClassModel.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ClassModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ClassModel is not found in the empty JSON string", ClassModel.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java index e56d439c0983..a04df3e85f83 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java @@ -175,9 +175,7 @@ public class Client { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Client.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Client.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Client is not found in the empty JSON string", Client.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java index 3bba54c82c61..a3b2b1cf2571 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -207,9 +207,7 @@ public class ComplexQuadrilateral { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ComplexQuadrilateral.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ComplexQuadrilateral.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ComplexQuadrilateral is not found in the empty JSON string", ComplexQuadrilateral.openapiRequiredFields.toString())); } } @@ -220,10 +218,10 @@ public class ComplexQuadrilateral { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonNull()) && !jsonObj.get("shapeType").isJsonPrimitive()) { + if (!jsonObj.get("shapeType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); } - if ((jsonObj.get("quadrilateralType") != null && !jsonObj.get("quadrilateralType").isJsonNull()) && !jsonObj.get("quadrilateralType").isJsonPrimitive()) { + if (!jsonObj.get("quadrilateralType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java index 96d8b02596b1..9ec2c05fc649 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DanishPig.java @@ -176,9 +176,7 @@ public class DanishPig { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (DanishPig.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!DanishPig.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in DanishPig is not found in the empty JSON string", DanishPig.openapiRequiredFields.toString())); } } @@ -189,7 +187,7 @@ public class DanishPig { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("className") != null && !jsonObj.get("className").isJsonNull()) && !jsonObj.get("className").isJsonPrimitive()) { + if (!jsonObj.get("className").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java index f3c38fe6372e..ef76ed5f9ca5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DeprecatedObject.java @@ -177,9 +177,7 @@ public class DeprecatedObject { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (DeprecatedObject.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!DeprecatedObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in DeprecatedObject is not found in the empty JSON string", DeprecatedObject.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java index 048569931f54..208d3c7494d2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java @@ -182,9 +182,7 @@ public class Dog extends Animal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Dog.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Dog.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Dog is not found in the empty JSON string", Dog.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java index 2690acccbb2b..b38a433b5edb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -175,9 +175,7 @@ public class DogAllOf { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (DogAllOf.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!DogAllOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in DogAllOf is not found in the empty JSON string", DogAllOf.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java index 26d5128dfb2d..917defa10c01 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Drawing.java @@ -254,9 +254,7 @@ public class Drawing { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Drawing.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Drawing.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Drawing is not found in the empty JSON string", Drawing.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java index 94e7f48086ce..bed415362381 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -309,9 +309,7 @@ public class EnumArrays { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EnumArrays.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EnumArrays.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EnumArrays is not found in the empty JSON string", EnumArrays.openapiRequiredFields.toString())); } } @@ -319,7 +317,7 @@ public class EnumArrays { throw new IllegalArgumentException(String.format("Expected the field `just_symbol` to be a primitive type in the JSON string but got `%s`", jsonObj.get("just_symbol").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull()) && !jsonObj.get("array_enum").isJsonArray()) { + if (!jsonObj.get("array_enum").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_enum` to be an array in the JSON string but got `%s`", jsonObj.get("array_enum").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java index 68b7873c90da..1b832638774c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumStringDiscriminator.java @@ -224,9 +224,7 @@ public class EnumStringDiscriminator { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EnumStringDiscriminator.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EnumStringDiscriminator.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EnumStringDiscriminator is not found in the empty JSON string", EnumStringDiscriminator.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java index f4a3b0c5df17..58a4f1dfa6b6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java @@ -671,9 +671,7 @@ public class EnumTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EnumTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EnumTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EnumTest is not found in the empty JSON string", EnumTest.openapiRequiredFields.toString())); } } @@ -687,7 +685,7 @@ public class EnumTest { if ((jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonNull()) && !jsonObj.get("enum_string").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `enum_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string").toString())); } - if ((jsonObj.get("enum_string_required") != null && !jsonObj.get("enum_string_required").isJsonNull()) && !jsonObj.get("enum_string_required").isJsonPrimitive()) { + if (!jsonObj.get("enum_string_required").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `enum_string_required` to be a primitive type in the JSON string but got `%s`", jsonObj.get("enum_string_required").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java index f79f0a0e706e..2812fa4d5a9a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -207,9 +207,7 @@ public class EquilateralTriangle { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (EquilateralTriangle.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!EquilateralTriangle.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in EquilateralTriangle is not found in the empty JSON string", EquilateralTriangle.openapiRequiredFields.toString())); } } @@ -220,10 +218,10 @@ public class EquilateralTriangle { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonNull()) && !jsonObj.get("shapeType").isJsonPrimitive()) { + if (!jsonObj.get("shapeType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); } - if ((jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonNull()) && !jsonObj.get("triangleType").isJsonPrimitive()) { + if (!jsonObj.get("triangleType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 93c37083bfe3..4acf99ff4634 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -216,9 +216,7 @@ public class FileSchemaTestClass { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (FileSchemaTestClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!FileSchemaTestClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in FileSchemaTestClass is not found in the empty JSON string", FileSchemaTestClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java index c55b7ee20ba9..e45183c138d6 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Foo.java @@ -175,9 +175,7 @@ public class Foo { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Foo.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Foo.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Foo is not found in the empty JSON string", Foo.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java index 7ad7dc95eeb8..69cf96e79712 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java @@ -176,9 +176,7 @@ public class FooGetDefaultResponse { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (FooGetDefaultResponse.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!FooGetDefaultResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in FooGetDefaultResponse is not found in the empty JSON string", FooGetDefaultResponse.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java index b8018926c1e7..f2b3766d0f50 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java @@ -644,9 +644,7 @@ public class FormatTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (FormatTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!FormatTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in FormatTest is not found in the empty JSON string", FormatTest.openapiRequiredFields.toString())); } } @@ -663,7 +661,7 @@ public class FormatTest { if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); } - if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + if (!jsonObj.get("password").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); } if ((jsonObj.get("pattern_with_digits") != null && !jsonObj.get("pattern_with_digits").isJsonNull()) && !jsonObj.get("pattern_with_digits").isJsonPrimitive()) { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java index 78a18c7e5a09..a5876f2aa317 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -178,9 +178,7 @@ public class GrandparentAnimal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (GrandparentAnimal.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!GrandparentAnimal.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in GrandparentAnimal is not found in the empty JSON string", GrandparentAnimal.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 68b14a887fdf..0fe00c40c3c3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -197,9 +197,7 @@ public class HasOnlyReadOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!HasOnlyReadOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in HasOnlyReadOnly is not found in the empty JSON string", HasOnlyReadOnly.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java index 889025a924dd..75f3d35db218 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -188,9 +188,7 @@ public class HealthCheckResult { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (HealthCheckResult.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!HealthCheckResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in HealthCheckResult is not found in the empty JSON string", HealthCheckResult.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java index 113cb33d57bb..d900a2689ca3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -170,9 +170,7 @@ public class IsoscelesTriangle { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (IsoscelesTriangle.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!IsoscelesTriangle.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in IsoscelesTriangle is not found in the empty JSON string", IsoscelesTriangle.openapiRequiredFields.toString())); } } @@ -191,10 +189,10 @@ public class IsoscelesTriangle { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonNull()) && !jsonObj.get("shapeType").isJsonPrimitive()) { + if (!jsonObj.get("shapeType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); } - if ((jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonNull()) && !jsonObj.get("triangleType").isJsonPrimitive()) { + if (!jsonObj.get("triangleType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java index 4113e915432e..8c4ff43c33b7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java @@ -346,9 +346,7 @@ public class MapTest { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (MapTest.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!MapTest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in MapTest is not found in the empty JSON string", MapTest.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index e48ad17fc228..31c906e162cb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -248,9 +248,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in MixedPropertiesAndAdditionalPropertiesClass is not found in the empty JSON string", MixedPropertiesAndAdditionalPropertiesClass.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java index 61d9112fe974..7ada25c4a32c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java @@ -206,9 +206,7 @@ public class Model200Response { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Model200Response.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Model200Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Model200Response is not found in the empty JSON string", Model200Response.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 01e954f66ba6..fd093ddf0036 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -235,9 +235,7 @@ public class ModelApiResponse { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelApiResponse.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java index 4d6419f76eb0..5dda8fc3e201 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelFile.java @@ -176,9 +176,7 @@ public class ModelFile { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelFile.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelFile is not found in the empty JSON string", ModelFile.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java index cb34415e8072..764fc3b52e24 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelList.java @@ -175,9 +175,7 @@ public class ModelList { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelList.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelList.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelList is not found in the empty JSON string", ModelList.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java index bcdbda2adb1b..ba7d286b5e8a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -176,9 +176,7 @@ public class ModelReturn { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ModelReturn.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ModelReturn.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ModelReturn is not found in the empty JSON string", ModelReturn.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java index d9257ca40378..46625eb3842b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java @@ -259,9 +259,7 @@ public class Name { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Name.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Name.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Name is not found in the empty JSON string", Name.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java index bd3774ed3e70..cadd5c9bed55 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableClass.java @@ -535,9 +535,7 @@ public class NullableClass { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (NullableClass.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!NullableClass.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in NullableClass is not found in the empty JSON string", NullableClass.openapiRequiredFields.toString())); } } @@ -553,15 +551,15 @@ public class NullableClass { throw new IllegalArgumentException(String.format("Expected the field `string_prop` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_prop").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_nullable_prop") != null && !jsonObj.get("array_nullable_prop").isJsonNull()) && !jsonObj.get("array_nullable_prop").isJsonArray()) { + if (!jsonObj.get("array_nullable_prop").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_nullable_prop").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_and_items_nullable_prop") != null && !jsonObj.get("array_and_items_nullable_prop").isJsonNull()) && !jsonObj.get("array_and_items_nullable_prop").isJsonArray()) { + if (!jsonObj.get("array_and_items_nullable_prop").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_and_items_nullable_prop` to be an array in the JSON string but got `%s`", jsonObj.get("array_and_items_nullable_prop").toString())); } // ensure the json data is an array - if ((jsonObj.get("array_items_nullable") != null && !jsonObj.get("array_items_nullable").isJsonNull()) && !jsonObj.get("array_items_nullable").isJsonArray()) { + if (!jsonObj.get("array_items_nullable").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `array_items_nullable` to be an array in the JSON string but got `%s`", jsonObj.get("array_items_nullable").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java index e9fe1272337f..76ed0276d9d7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -176,9 +176,7 @@ public class NumberOnly { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (NumberOnly.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!NumberOnly.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in NumberOnly is not found in the empty JSON string", NumberOnly.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java index 7b55a6cef055..81633a463d0e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java @@ -283,9 +283,7 @@ public class ObjectWithDeprecatedFields { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ObjectWithDeprecatedFields.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ObjectWithDeprecatedFields.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ObjectWithDeprecatedFields is not found in the empty JSON string", ObjectWithDeprecatedFields.openapiRequiredFields.toString())); } } @@ -297,7 +295,7 @@ public class ObjectWithDeprecatedFields { DeprecatedObject.validateJsonObject(jsonObj.getAsJsonObject("deprecatedRef")); } // ensure the json data is an array - if ((jsonObj.get("bars") != null && !jsonObj.get("bars").isJsonNull()) && !jsonObj.get("bars").isJsonArray()) { + if (!jsonObj.get("bars").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `bars` to be an array in the JSON string but got `%s`", jsonObj.get("bars").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java index 9f7825a59524..da6dc68411ff 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java @@ -375,9 +375,7 @@ public class Order { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Order.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java index 8d87f9559e27..eaf4cbc92284 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -236,9 +236,7 @@ public class OuterComposite { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (OuterComposite.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!OuterComposite.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OuterComposite is not found in the empty JSON string", OuterComposite.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ParentPet.java index 5f2424d94cb4..cdb27e8560cc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ParentPet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ParentPet.java @@ -149,9 +149,7 @@ public class ParentPet extends GrandparentAnimal { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ParentPet.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ParentPet.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ParentPet is not found in the empty JSON string", ParentPet.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java index 70314a8f84e8..1c506e68a824 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java @@ -393,9 +393,7 @@ public class Pet { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Pet.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); } } @@ -410,7 +408,7 @@ public class Pet { if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // ensure the json data is an array diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java index 2ec5b310db37..94f5d943e17c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/PetWithRequiredTags.java @@ -391,9 +391,7 @@ public class PetWithRequiredTags { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (PetWithRequiredTags.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!PetWithRequiredTags.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in PetWithRequiredTags is not found in the empty JSON string", PetWithRequiredTags.openapiRequiredFields.toString())); } } @@ -408,27 +406,23 @@ public class PetWithRequiredTags { if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { Category.validateJsonObject(jsonObj.getAsJsonObject("category")); } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // ensure the json data is an array if ((jsonObj.get("photoUrls") != null && !jsonObj.get("photoUrls").isJsonNull()) && !jsonObj.get("photoUrls").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); } - if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { - JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); - if (jsonArraytags != null) { - // ensure the json data is an array - if (!jsonObj.get("tags").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); - } - - // validate the optional field `tags` (array) - for (int i = 0; i < jsonArraytags.size(); i++) { - Tag.validateJsonObject(jsonArraytags.get(i).getAsJsonObject()); - }; - } + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); } + + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + // validate the required field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tag.validateJsonObject(jsonArraytags.get(i).getAsJsonObject()); + }; if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java index db2687315124..887c057b99a9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -176,9 +176,7 @@ public class QuadrilateralInterface { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (QuadrilateralInterface.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!QuadrilateralInterface.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in QuadrilateralInterface is not found in the empty JSON string", QuadrilateralInterface.openapiRequiredFields.toString())); } } @@ -189,7 +187,7 @@ public class QuadrilateralInterface { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("quadrilateralType") != null && !jsonObj.get("quadrilateralType").isJsonNull()) && !jsonObj.get("quadrilateralType").isJsonPrimitive()) { + if (!jsonObj.get("quadrilateralType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index aeefc570c1d1..ab4743206775 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -204,9 +204,7 @@ public class ReadOnlyFirst { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ReadOnlyFirst.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ReadOnlyFirst.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ReadOnlyFirst is not found in the empty JSON string", ReadOnlyFirst.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java index 007e33d32e37..9c7d73ef973a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -207,9 +207,7 @@ public class ScaleneTriangle { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ScaleneTriangle.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ScaleneTriangle.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ScaleneTriangle is not found in the empty JSON string", ScaleneTriangle.openapiRequiredFields.toString())); } } @@ -220,10 +218,10 @@ public class ScaleneTriangle { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonNull()) && !jsonObj.get("shapeType").isJsonPrimitive()) { + if (!jsonObj.get("shapeType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); } - if ((jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonNull()) && !jsonObj.get("triangleType").isJsonPrimitive()) { + if (!jsonObj.get("triangleType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java index b5ce10e7819d..14bfd02fffef 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -176,9 +176,7 @@ public class ShapeInterface { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (ShapeInterface.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!ShapeInterface.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ShapeInterface is not found in the empty JSON string", ShapeInterface.openapiRequiredFields.toString())); } } @@ -189,7 +187,7 @@ public class ShapeInterface { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonNull()) && !jsonObj.get("shapeType").isJsonPrimitive()) { + if (!jsonObj.get("shapeType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java index c7ffcbc96851..6296f4423fbf 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -207,9 +207,7 @@ public class SimpleQuadrilateral { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (SimpleQuadrilateral.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!SimpleQuadrilateral.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in SimpleQuadrilateral is not found in the empty JSON string", SimpleQuadrilateral.openapiRequiredFields.toString())); } } @@ -220,10 +218,10 @@ public class SimpleQuadrilateral { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("shapeType") != null && !jsonObj.get("shapeType").isJsonNull()) && !jsonObj.get("shapeType").isJsonPrimitive()) { + if (!jsonObj.get("shapeType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `shapeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shapeType").toString())); } - if ((jsonObj.get("quadrilateralType") != null && !jsonObj.get("quadrilateralType").isJsonNull()) && !jsonObj.get("quadrilateralType").isJsonPrimitive()) { + if (!jsonObj.get("quadrilateralType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `quadrilateralType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("quadrilateralType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java index d0c65534204c..52f467174ced 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -205,9 +205,7 @@ public class SpecialModelName { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (SpecialModelName.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!SpecialModelName.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in SpecialModelName is not found in the empty JSON string", SpecialModelName.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java index de5eead669fd..64e7edf96179 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java @@ -205,9 +205,7 @@ public class Tag { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Tag.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java index 4ab097da2f31..481cc8ff83cf 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -176,9 +176,7 @@ public class TriangleInterface { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (TriangleInterface.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!TriangleInterface.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in TriangleInterface is not found in the empty JSON string", TriangleInterface.openapiRequiredFields.toString())); } } @@ -189,7 +187,7 @@ public class TriangleInterface { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("triangleType") != null && !jsonObj.get("triangleType").isJsonNull()) && !jsonObj.get("triangleType").isJsonPrimitive()) { + if (!jsonObj.get("triangleType").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `triangleType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("triangleType").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java index a8c2c81845f2..cdf8d7b86c04 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java @@ -517,9 +517,7 @@ public class User { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (User.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java index 8fb35fd9ff98..a2b89819cc4f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Whale.java @@ -236,9 +236,7 @@ public class Whale { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Whale.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Whale.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Whale is not found in the empty JSON string", Whale.openapiRequiredFields.toString())); } } @@ -249,7 +247,7 @@ public class Whale { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } } - if ((jsonObj.get("className") != null && !jsonObj.get("className").isJsonNull()) && !jsonObj.get("className").isJsonPrimitive()) { + if (!jsonObj.get("className").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java index 68002378db7d..61d7009c60a7 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Zebra.java @@ -255,9 +255,7 @@ public class Zebra { */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (Zebra.openapiRequiredFields.isEmpty()) { - return; - } else { // has required fields + if (!Zebra.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in Zebra is not found in the empty JSON string", Zebra.openapiRequiredFields.toString())); } } @@ -271,7 +269,7 @@ public class Zebra { if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } - if ((jsonObj.get("className") != null && !jsonObj.get("className").isJsonNull()) && !jsonObj.get("className").isJsonPrimitive()) { + if (!jsonObj.get("className").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `className` to be a primitive type in the JSON string but got `%s`", jsonObj.get("className").toString())); } } diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java index 889ac0719087..4c79a25d1fee 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java @@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.*; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import java.io.IOException; @@ -544,6 +545,19 @@ public class JSONTest { } } + + /** + * Test validateJsonObject with null object + */ + @Test + public void testValidateJsonObject() throws Exception { + JsonObject jsonObject = new JsonObject(); + Exception exception = assertThrows(java.lang.IllegalArgumentException.class, () -> { + Pet.validateJsonObject(jsonObject); + }); + assertEquals(exception.getMessage(), "The required field `photoUrls` is not found in the JSON string: {}"); + } + /** * Test additional properties. */