[java] fixed pojo template for nullable fields (#12630)

* [java] fixed pojo template for nullable fields

* regenerated samples
This commit is contained in:
Mauro Valota
2022-07-23 05:19:48 +02:00
committed by GitHub
parent 9f2f36c4fb
commit ea7a319a65
131 changed files with 260 additions and 260 deletions

View File

@@ -152,7 +152,7 @@ public class AdditionalPropertiesAnyType {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesAnyType` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -153,7 +153,7 @@ public class AdditionalPropertiesArray {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesArray` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -152,7 +152,7 @@ public class AdditionalPropertiesBoolean {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesBoolean` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -152,7 +152,7 @@ public class AdditionalPropertiesInteger {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesInteger` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -153,7 +153,7 @@ public class AdditionalPropertiesNumber {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesNumber` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -153,7 +153,7 @@ public class AdditionalPropertiesObject {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesObject` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -152,7 +152,7 @@ public class AdditionalPropertiesString {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesString` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -164,7 +164,7 @@ public class ArrayOfArrayOfNumberOnly {
}
}
// ensure the json data is an array
if (jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonArray()) {
if ((jsonObj.get("ArrayArrayNumber") != null && !jsonObj.get("ArrayArrayNumber").isJsonNull()) && !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()));
}
}

View File

@@ -164,7 +164,7 @@ public class ArrayOfNumberOnly {
}
}
// ensure the json data is an array
if (jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonArray()) {
if ((jsonObj.get("ArrayNumber") != null && !jsonObj.get("ArrayNumber").isJsonNull()) && !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()));
}
}

View File

@@ -240,15 +240,15 @@ public class ArrayTest {
}
}
// ensure the json data is an array
if (jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonArray()) {
if ((jsonObj.get("array_of_string") != null && !jsonObj.get("array_of_string").isJsonNull()) && !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").isJsonArray()) {
if ((jsonObj.get("array_array_of_integer") != null && !jsonObj.get("array_array_of_integer").isJsonNull()) && !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").isJsonArray()) {
if ((jsonObj.get("array_array_of_model") != null && !jsonObj.get("array_array_of_model").isJsonNull()) && !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()));
}
}

View File

@@ -203,7 +203,7 @@ public class BigCatAllOf {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BigCatAllOf` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonPrimitive()) {
if ((jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonNull()) && !jsonObj.get("kind").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString()));
}
}

View File

@@ -302,22 +302,22 @@ public class Capitalization {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Capitalization` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonPrimitive()) {
if ((jsonObj.get("smallCamel") != null && !jsonObj.get("smallCamel").isJsonNull()) && !jsonObj.get("smallCamel").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `smallCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("smallCamel").toString()));
}
if (jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonPrimitive()) {
if ((jsonObj.get("CapitalCamel") != null && !jsonObj.get("CapitalCamel").isJsonNull()) && !jsonObj.get("CapitalCamel").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `CapitalCamel` to be a primitive type in the JSON string but got `%s`", jsonObj.get("CapitalCamel").toString()));
}
if (jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonPrimitive()) {
if ((jsonObj.get("small_Snake") != null && !jsonObj.get("small_Snake").isJsonNull()) && !jsonObj.get("small_Snake").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `small_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("small_Snake").toString()));
}
if (jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonPrimitive()) {
if ((jsonObj.get("Capital_Snake") != null && !jsonObj.get("Capital_Snake").isJsonNull()) && !jsonObj.get("Capital_Snake").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `Capital_Snake` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Capital_Snake").toString()));
}
if (jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) {
if ((jsonObj.get("SCA_ETH_Flow_Points") != null && !jsonObj.get("SCA_ETH_Flow_Points").isJsonNull()) && !jsonObj.get("SCA_ETH_Flow_Points").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `SCA_ETH_Flow_Points` to be a primitive type in the JSON string but got `%s`", jsonObj.get("SCA_ETH_Flow_Points").toString()));
}
if (jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonPrimitive()) {
if ((jsonObj.get("ATT_NAME") != null && !jsonObj.get("ATT_NAME").isJsonNull()) && !jsonObj.get("ATT_NAME").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `ATT_NAME` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ATT_NAME").toString()));
}
}

View File

@@ -190,7 +190,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").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -153,7 +153,7 @@ public class ClassModel {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClassModel` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonPrimitive()) {
if ((jsonObj.get("_class") != null && !jsonObj.get("_class").isJsonNull()) && !jsonObj.get("_class").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `_class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_class").toString()));
}
}

View File

@@ -152,7 +152,7 @@ public class Client {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Client` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("client") != null && !jsonObj.get("client").isJsonPrimitive()) {
if ((jsonObj.get("client") != null && !jsonObj.get("client").isJsonNull()) && !jsonObj.get("client").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `client` to be a primitive type in the JSON string but got `%s`", jsonObj.get("client").toString()));
}
}

View File

@@ -152,7 +152,7 @@ public class DogAllOf {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DogAllOf` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("breed") != null && !jsonObj.get("breed").isJsonPrimitive()) {
if ((jsonObj.get("breed") != null && !jsonObj.get("breed").isJsonNull()) && !jsonObj.get("breed").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `breed` to be a primitive type in the JSON string but got `%s`", jsonObj.get("breed").toString()));
}
}

View File

@@ -286,11 +286,11 @@ public class EnumArrays {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EnumArrays` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonPrimitive()) {
if ((jsonObj.get("just_symbol") != null && !jsonObj.get("just_symbol").isJsonNull()) && !jsonObj.get("just_symbol").isJsonPrimitive()) {
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").isJsonArray()) {
if ((jsonObj.get("array_enum") != null && !jsonObj.get("array_enum").isJsonNull()) && !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()));
}
}

View File

@@ -473,10 +473,10 @@ public class EnumTest {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString()));
}
}
if (jsonObj.get("enum_string") != null && !jsonObj.get("enum_string").isJsonPrimitive()) {
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").isJsonPrimitive()) {
if ((jsonObj.get("enum_string_required") != null && !jsonObj.get("enum_string_required").isJsonNull()) && !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()));
}
}

View File

@@ -194,7 +194,7 @@ public class FileSchemaTestClass {
}
}
// validate the optional field `file`
if (jsonObj.getAsJsonObject("file") != null) {
if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) {
ModelFile.validateJsonObject(jsonObj.getAsJsonObject("file"));
}
JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files");

View File

@@ -568,13 +568,13 @@ public class FormatTest {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString()));
}
}
if (jsonObj.get("string") != null && !jsonObj.get("string").isJsonPrimitive()) {
if ((jsonObj.get("string") != null && !jsonObj.get("string").isJsonNull()) && !jsonObj.get("string").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString()));
}
if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) {
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").isJsonPrimitive()) {
if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !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()));
}
}

View File

@@ -174,10 +174,10 @@ public class HasOnlyReadOnly {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HasOnlyReadOnly` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) {
if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString()));
}
if (jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonPrimitive()) {
if ((jsonObj.get("foo") != null && !jsonObj.get("foo").isJsonNull()) && !jsonObj.get("foo").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `foo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("foo").toString()));
}
}

View File

@@ -225,7 +225,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MixedPropertiesAndAdditionalPropertiesClass` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonPrimitive()) {
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()));
}
}

View File

@@ -183,7 +183,7 @@ public class Model200Response {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Model200Response` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("class") != null && !jsonObj.get("class").isJsonPrimitive()) {
if ((jsonObj.get("class") != null && !jsonObj.get("class").isJsonNull()) && !jsonObj.get("class").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `class` to be a primitive type in the JSON string but got `%s`", jsonObj.get("class").toString()));
}
}

View File

@@ -212,10 +212,10 @@ public class ModelApiResponse {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelApiResponse` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonPrimitive()) {
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("message") != null && !jsonObj.get("message").isJsonPrimitive()) {
if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString()));
}
}

View File

@@ -153,7 +153,7 @@ public class ModelFile {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelFile` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonPrimitive()) {
if ((jsonObj.get("sourceURI") != null && !jsonObj.get("sourceURI").isJsonNull()) && !jsonObj.get("sourceURI").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `sourceURI` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceURI").toString()));
}
}

View File

@@ -152,7 +152,7 @@ public class ModelList {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ModelList` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonPrimitive()) {
if ((jsonObj.get("123-list") != null && !jsonObj.get("123-list").isJsonNull()) && !jsonObj.get("123-list").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `123-list` to be a primitive type in the JSON string but got `%s`", jsonObj.get("123-list").toString()));
}
}

View File

@@ -243,7 +243,7 @@ public class Name {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString()));
}
}
if (jsonObj.get("property") != null && !jsonObj.get("property").isJsonPrimitive()) {
if ((jsonObj.get("property") != null && !jsonObj.get("property").isJsonNull()) && !jsonObj.get("property").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `property` to be a primitive type in the JSON string but got `%s`", jsonObj.get("property").toString()));
}
}

View File

@@ -352,7 +352,7 @@ public class Order {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Order` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) {
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()));
}
}

View File

@@ -213,7 +213,7 @@ public class OuterComposite {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OuterComposite` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonPrimitive()) {
if ((jsonObj.get("my_string") != null && !jsonObj.get("my_string").isJsonNull()) && !jsonObj.get("my_string").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `my_string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("my_string").toString()));
}
}

View File

@@ -380,14 +380,14 @@ public class Pet {
}
}
// validate the optional field `category`
if (jsonObj.getAsJsonObject("category") != null) {
if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) {
Category.validateJsonObject(jsonObj.getAsJsonObject("category"));
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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").isJsonArray()) {
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()));
}
JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags");
@@ -402,7 +402,7 @@ public class Pet {
Tag.validateJsonObject(jsonArraytags.get(i).getAsJsonObject());
};
}
if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonPrimitive()) {
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()));
}
}

View File

@@ -181,10 +181,10 @@ public class ReadOnlyFirst {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReadOnlyFirst` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonPrimitive()) {
if ((jsonObj.get("bar") != null && !jsonObj.get("bar").isJsonNull()) && !jsonObj.get("bar").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `bar` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bar").toString()));
}
if (jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonPrimitive()) {
if ((jsonObj.get("baz") != null && !jsonObj.get("baz").isJsonNull()) && !jsonObj.get("baz").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `baz` to be a primitive type in the JSON string but got `%s`", jsonObj.get("baz").toString()));
}
}

View File

@@ -182,7 +182,7 @@ public class Tag {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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()));
}
}

View File

@@ -292,11 +292,11 @@ 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").isJsonPrimitive()) {
if ((jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonNull()) && !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
if (jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonArray()) {
if ((jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonNull()) && !jsonObj.get("array_item").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString()));
}
}

View File

@@ -323,11 +323,11 @@ 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").isJsonPrimitive()) {
if ((jsonObj.get("string_item") != null && !jsonObj.get("string_item").isJsonNull()) && !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
if (jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonArray()) {
if ((jsonObj.get("array_item") != null && !jsonObj.get("array_item").isJsonNull()) && !jsonObj.get("array_item").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `array_item` to be an array in the JSON string but got `%s`", jsonObj.get("array_item").toString()));
}
}

View File

@@ -362,22 +362,22 @@ public class User {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("username") != null && !jsonObj.get("username").isJsonPrimitive()) {
if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString()));
}
if (jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonPrimitive()) {
if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString()));
}
if (jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonPrimitive()) {
if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString()));
}
if (jsonObj.get("email") != null && !jsonObj.get("email").isJsonPrimitive()) {
if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString()));
}
if (jsonObj.get("password") != null && !jsonObj.get("password").isJsonPrimitive()) {
if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !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("phone") != null && !jsonObj.get("phone").isJsonPrimitive()) {
if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString()));
}
}

View File

@@ -1067,55 +1067,55 @@ public class XmlItem {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `XmlItem` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
}
}
if (jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonPrimitive()) {
if ((jsonObj.get("attribute_string") != null && !jsonObj.get("attribute_string").isJsonNull()) && !jsonObj.get("attribute_string").isJsonPrimitive()) {
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").isJsonArray()) {
if ((jsonObj.get("wrapped_array") != null && !jsonObj.get("wrapped_array").isJsonNull()) && !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").isJsonPrimitive()) {
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").isJsonArray()) {
if ((jsonObj.get("name_array") != null && !jsonObj.get("name_array").isJsonNull()) && !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").isJsonArray()) {
if ((jsonObj.get("name_wrapped_array") != null && !jsonObj.get("name_wrapped_array").isJsonNull()) && !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").isJsonPrimitive()) {
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").isJsonArray()) {
if ((jsonObj.get("prefix_array") != null && !jsonObj.get("prefix_array").isJsonNull()) && !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").isJsonArray()) {
if ((jsonObj.get("prefix_wrapped_array") != null && !jsonObj.get("prefix_wrapped_array").isJsonNull()) && !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").isJsonPrimitive()) {
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").isJsonArray()) {
if ((jsonObj.get("namespace_array") != null && !jsonObj.get("namespace_array").isJsonNull()) && !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").isJsonArray()) {
if ((jsonObj.get("namespace_wrapped_array") != null && !jsonObj.get("namespace_wrapped_array").isJsonNull()) && !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").isJsonPrimitive()) {
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").isJsonArray()) {
if ((jsonObj.get("prefix_ns_array") != null && !jsonObj.get("prefix_ns_array").isJsonNull()) && !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").isJsonArray()) {
if ((jsonObj.get("prefix_ns_wrapped_array") != null && !jsonObj.get("prefix_ns_wrapped_array").isJsonNull()) && !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()));
}
}