diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index c2b1a9aa93b0..d840194d688f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -46,6 +46,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Stream; import static com.google.common.base.CaseFormat.LOWER_CAMEL; import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE; @@ -1255,6 +1256,15 @@ public Map postProcessAllModels(Map objs) break; } } + // AbstractOpenApiSchema already declares Boolean isNullable(), so a oneOf/anyOf + // member named Nullable gets no is() check + if (cm.getComposedSchemas() != null) { + Stream.of(cm.getComposedSchemas().getOneOf(), cm.getComposedSchemas().getAnyOf()) + .filter(Objects::nonNull) + .flatMap(List::stream) + .filter(member -> "Nullable".equals(sanitizeDataType(member.dataType))) + .forEach(member -> member.vendorExtensions.put("x-is-method-inherited", true)); + } } } return objs; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache index e1760876459d..7ea7f78eb39d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache @@ -248,6 +248,21 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im setActualInstance(o); } + {{#composedSchemas}} + {{#anyOf}} + {{^vendorExtensions.x-duplicated-data-type}} + {{^isAnyType}} + {{^isFreeFormObject}} + public {{classname}}({{{dataType}}} o) { + this(); + setActualInstance(o); + } + + {{/isFreeFormObject}} + {{/isAnyType}} + {{/vendorExtensions.x-duplicated-data-type}} + {{/anyOf}} + {{/composedSchemas}} static { {{#composedSchemas}} {{#anyOf}} @@ -328,6 +343,23 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im return ({{{dataType}}})super.getActualInstance(); } + {{^vendorExtensions.x-is-method-inherited}} + {{^isContainer}} + {{^isAnyType}} + {{^isFreeFormObject}} + /** + * Check if the actual instance is of the type `{{dataType}}`. + * + * @return true if the actual instance is of the type `{{dataType}}` + */ + public boolean is{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}() { + return super.getActualInstance() instanceof {{{dataType}}}; + } + + {{/isFreeFormObject}} + {{/isAnyType}} + {{/isContainer}} + {{/vendorExtensions.x-is-method-inherited}} {{/vendorExtensions.x-duplicated-data-type-ignoring-erasure}} {{/anyOf}} {{/composedSchemas}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache index dc71a8beb320..d5c5b6532d53 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/oneof_model.mustache @@ -298,6 +298,21 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im setActualInstance(o); } + {{#composedSchemas}} + {{#oneOf}} + {{^vendorExtensions.x-duplicated-data-type}} + {{^isAnyType}} + {{^isFreeFormObject}} + public {{classname}}({{{dataType}}} o) { + this(); + setActualInstance(o); + } + + {{/isFreeFormObject}} + {{/isAnyType}} + {{/vendorExtensions.x-duplicated-data-type}} + {{/oneOf}} + {{/composedSchemas}} static { {{#composedSchemas}} {{#oneOf}} @@ -379,6 +394,23 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im return ({{{dataType}}})super.getActualInstance(); } + {{^vendorExtensions.x-is-method-inherited}} + {{^isContainer}} + {{^isAnyType}} + {{^isFreeFormObject}} + /** + * Check if the actual instance is of the type `{{dataType}}`. + * + * @return true if the actual instance is of the type `{{dataType}}` + */ + public boolean is{{#sanitizeDataType}}{{{dataType}}}{{/sanitizeDataType}}() { + return super.getActualInstance() instanceof {{{dataType}}}; + } + + {{/isFreeFormObject}} + {{/isAnyType}} + {{/isContainer}} + {{/vendorExtensions.x-is-method-inherited}} {{/vendorExtensions.x-duplicated-data-type-ignoring-erasure}} {{/oneOf}} {{/composedSchemas}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 256c2203428e..cb33d40b0a30 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -4561,6 +4561,62 @@ public void testNativeOneOfAnyOfWithContainerMembers() { .doesNotContain("getList()", "List.class"); } + @Test + public void testOkHttpGsonOneOfAnyOfTypedConstructors() { + final Path output = newTempFolder(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(JAVA_GENERATOR) + .setLibrary(JavaClientCodegen.OKHTTP_GSON) + .setInputSpec("src/test/resources/3_0/java/okhttp-gson-composed-typed-constructors.yaml") + .setOutputDir(output.toString().replace("\\", "/")); + + List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + + validateJavaSourceFiles(files); + final Path modelDir = output.resolve("src/main/java/org/openapitools/client/model"); + assertThat(modelDir.resolve("OpenPetStatus.java")).content() + .contains( + "public OpenPetStatus(Object o) {", + "public OpenPetStatus(PetStatus o) {", + "public OpenPetStatus(String o) {", + "public boolean isPetStatus() {", + "return super.getActualInstance() instanceof PetStatus;", + "public boolean isString() {"); + assertThat(modelDir.resolve("Scalar.java")).content() + .contains( + "public Scalar(BigDecimal o) {", + "public Scalar(Integer o) {", + "public Scalar(Long o) {", + "public Scalar(Boolean o) {"); + // instanceof can't tell List from another list, so containers get no is method + assertThat(modelDir.resolve("PetOrPets.java")).content() + .contains("public PetOrPets(Pet o) {", "public PetOrPets(List o) {", "public boolean isPet() {") + .doesNotContain("public boolean isList"); + // List and List have the same erasure, so only the first gets a constructor. + assertThat(modelDir.resolve("Numbers.java")).content() + .contains("public Numbers(List o) {") + .doesNotContain("public Numbers(List o) {"); + // Free-form and any-type members are an Object, which the existing constructor already accepts + // and which every instance would match. + assertThat(modelDir.resolve("PetOrAnything.java")).content() + .containsOnlyOnce("public PetOrAnything(Object o) {") + .contains("public PetOrAnything(Pet o) {", "public boolean isPet() {", "public Object getObject() throws ClassCastException {") + .doesNotContain("public boolean isObject() {"); + assertThat(modelDir.resolve("PetOrFreeForm.java")).content() + .containsOnlyOnce("public PetOrFreeForm(Object o) {") + .contains("public PetOrFreeForm(Pet o) {", "public boolean isPet() {") + .doesNotContain("public boolean isObject() {"); + assertThat(modelDir.resolve("NullablePetOrName.java")).content() + .contains("public NullablePetOrName(Pet o) {", "public NullablePetOrName(String o) {"); + // AbstractOpenApiSchema already declares Boolean isNullable() + assertThat(modelDir.resolve("PetOrNullable.java")).content() + .contains("public PetOrNullable(Nullable o) {", "public Nullable getNullable() throws ClassCastException {", "public boolean isPet() {") + .doesNotContain("public boolean isNullable() {"); + assertThat(modelDir.resolve("NullableOrName.java")).content() + .contains("public NullableOrName(Nullable o) {", "public Nullable getNullable() throws ClassCastException {", "public boolean isString() {") + .doesNotContain("public boolean isNullable() {"); + } + @Test public void testEnumWithImplements() { final Path output = newTempFolder(); diff --git a/modules/openapi-generator/src/test/resources/3_0/java/okhttp-gson-composed-typed-constructors.yaml b/modules/openapi-generator/src/test/resources/3_0/java/okhttp-gson-composed-typed-constructors.yaml new file mode 100644 index 000000000000..592eb723cd5f --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/java/okhttp-gson-composed-typed-constructors.yaml @@ -0,0 +1,104 @@ +openapi: 3.0.3 +info: + title: oneOf/anyOf typed constructors + description: oneOf/anyOf members that need a typed constructor in the okhttp-gson client, and members that must not get one + version: 1.0.0 +servers: + - url: http://localhost +paths: + /composed: + get: + operationId: getComposed + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Composed' +components: + schemas: + Composed: + type: object + properties: + status: + $ref: '#/components/schemas/OpenPetStatus' + scalar: + $ref: '#/components/schemas/Scalar' + petOrPets: + $ref: '#/components/schemas/PetOrPets' + numbers: + $ref: '#/components/schemas/Numbers' + petOrAnything: + $ref: '#/components/schemas/PetOrAnything' + petOrFreeForm: + $ref: '#/components/schemas/PetOrFreeForm' + nullablePetOrName: + $ref: '#/components/schemas/NullablePetOrName' + petOrNullable: + $ref: '#/components/schemas/PetOrNullable' + nullableOrName: + $ref: '#/components/schemas/NullableOrName' + PetStatus: + type: string + enum: + - available + - pending + - sold + OpenPetStatus: + anyOf: + - $ref: '#/components/schemas/PetStatus' + - type: string + Scalar: + oneOf: + - type: number + - type: integer + format: int32 + - type: integer + format: int64 + - type: boolean + Pet: + type: object + properties: + name: + type: string + PetOrPets: + oneOf: + - $ref: '#/components/schemas/Pet' + - type: array + items: + $ref: '#/components/schemas/Pet' + Numbers: + anyOf: + - type: array + items: + type: number + - type: array + items: + type: integer + PetOrAnything: + anyOf: + - $ref: '#/components/schemas/Pet' + - description: Any value + PetOrFreeForm: + oneOf: + - $ref: '#/components/schemas/Pet' + - type: object + NullablePetOrName: + nullable: true + oneOf: + - $ref: '#/components/schemas/Pet' + - type: string + Nullable: + type: object + properties: + reason: + type: string + PetOrNullable: + oneOf: + - $ref: '#/components/schemas/Pet' + - $ref: '#/components/schemas/Nullable' + NullableOrName: + anyOf: + - $ref: '#/components/schemas/Nullable' + - type: string diff --git a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java index 4657204c26f9..c984c5a38179 100644 --- a/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java +++ b/samples/client/others/java/okhttp-gson-oneOf-array/src/main/java/org/openapitools/client/model/MyExampleGet200Response.java @@ -170,6 +170,16 @@ public MyExampleGet200Response(Object o) { setActualInstance(o); } + public MyExampleGet200Response(List<@Valid OneOf1> o) { + this(); + setActualInstance(o); + } + + public MyExampleGet200Response(OneOf1 o) { + this(); + setActualInstance(o); + } + static { schemas.put("List<@Valid OneOf1>", List.class); schemas.put("OneOf1", OneOf1.class); @@ -241,6 +251,15 @@ public OneOf1 getOneOf1() throws ClassCastException { return (OneOf1)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `OneOf1`. + * + * @return true if the actual instance is of the type `OneOf1` + */ + public boolean isOneOf1() { + return super.getActualInstance() instanceof OneOf1; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java index 082bd1878b32..e8fc2b720346 100644 --- a/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java +++ b/samples/client/others/java/okhttp-gson-oneOf/src/main/java/org/openapitools/client/model/MyExamplePostRequest.java @@ -129,6 +129,11 @@ public MyExamplePostRequest(Object o) { setActualInstance(o); } + public MyExamplePostRequest(String o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); } @@ -179,6 +184,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java index 07932d5fc0b7..2186812af952 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/model/SimpleOneOf.java @@ -151,6 +151,16 @@ public SimpleOneOf(Object o) { setActualInstance(o); } + public SimpleOneOf(String o) { + this(); + setActualInstance(o); + } + + public SimpleOneOf(Integer o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Integer", Integer.class); @@ -207,6 +217,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Integer`. If the actual instance is not `Integer`, * the ClassCastException will be thrown. @@ -219,6 +238,15 @@ public Integer getInteger() throws ClassCastException { return (Integer)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Integer`. + * + * @return true if the actual instance is of the type `Integer` + */ + public boolean isInteger() { + return super.getActualInstance() instanceof Integer; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java index c04457ab3f31..b9566197b989 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/OneOfStringOrInt.java @@ -150,6 +150,16 @@ public OneOfStringOrInt(Object o) { setActualInstance(o); } + public OneOfStringOrInt(String o) { + this(); + setActualInstance(o); + } + + public OneOfStringOrInt(Integer o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Integer", Integer.class); @@ -206,6 +216,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Integer`. If the actual instance is not `Integer`, * the ClassCastException will be thrown. @@ -218,6 +237,15 @@ public Integer getInteger() throws ClassCastException { return (Integer)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Integer`. + * + * @return true if the actual instance is of the type `Integer` + */ + public boolean isInteger() { + return super.getActualInstance() instanceof Integer; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java index f83522333b39..114ae1f13e95 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java @@ -150,6 +150,16 @@ public RefRefToPathLevelParameterOneofRefToOneofParameter(Object o) { setActualInstance(o); } + public RefRefToPathLevelParameterOneofRefToOneofParameter(String o) { + this(); + setActualInstance(o); + } + + public RefRefToPathLevelParameterOneofRefToOneofParameter(Integer o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Integer", Integer.class); @@ -206,6 +216,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Integer`. If the actual instance is not `Integer`, * the ClassCastException will be thrown. @@ -218,6 +237,15 @@ public Integer getInteger() throws ClassCastException { return (Integer)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Integer`. + * + * @return true if the actual instance is of the type `Integer` + */ + public boolean isInteger() { + return super.getActualInstance() instanceof Integer; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java index 3c5843ad08a7..e6e5f169e147 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java @@ -161,6 +161,16 @@ public RefToRefParameterAnyofRefToAnyofParameter(Object o) { setActualInstance(o); } + public RefToRefParameterAnyofRefToAnyofParameter(String o) { + this(); + setActualInstance(o); + } + + public RefToRefParameterAnyofRefToAnyofParameter(List o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("List", List.class); @@ -220,6 +230,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `List<String>`. If the actual instance is not `List<String>`, * the ClassCastException will be thrown. diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java index 5cc19cc93ed4..37b86d7b2c27 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java @@ -145,6 +145,16 @@ public SelfReferenceAnyOf(Object o) { setActualInstance(o); } + public SelfReferenceAnyOf(String o) { + this(); + setActualInstance(o); + } + + public SelfReferenceAnyOf(Boolean o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Boolean", Boolean.class); @@ -200,6 +210,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, * the ClassCastException will be thrown. @@ -211,6 +230,15 @@ public Boolean getBoolean() throws ClassCastException { return (Boolean)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Boolean`. + * + * @return true if the actual instance is of the type `Boolean` + */ + public boolean isBoolean() { + return super.getActualInstance() instanceof Boolean; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java index d0ef79421e47..f5700037ad85 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java @@ -150,6 +150,16 @@ public SelfReferenceOneOf(Object o) { setActualInstance(o); } + public SelfReferenceOneOf(String o) { + this(); + setActualInstance(o); + } + + public SelfReferenceOneOf(Boolean o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Boolean", Boolean.class); @@ -206,6 +216,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, * the ClassCastException will be thrown. @@ -218,6 +237,15 @@ public Boolean getBoolean() throws ClassCastException { return (Boolean)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Boolean`. + * + * @return true if the actual instance is of the type `Boolean` + */ + public boolean isBoolean() { + return super.getActualInstance() instanceof Boolean; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java index 9a0a38075b95..7249af02cc0d 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/model/StringOrInt.java @@ -145,6 +145,16 @@ public StringOrInt(Object o) { setActualInstance(o); } + public StringOrInt(String o) { + this(); + setActualInstance(o); + } + + public StringOrInt(Integer o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Integer", Integer.class); @@ -200,6 +210,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Integer`. If the actual instance is not `Integer`, * the ClassCastException will be thrown. @@ -211,6 +230,15 @@ public Integer getInteger() throws ClassCastException { return (Integer)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Integer`. + * + * @return true if the actual instance is of the type `Integer` + */ + public boolean isInteger() { + return super.getActualInstance() instanceof Integer; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java index f73ad4b3df7a..9ec4b96043ba 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfAttributesC.java @@ -160,6 +160,16 @@ public AllOfModelArrayAnyOfAllOfAttributesC(Object o) { setActualInstance(o); } + public AllOfModelArrayAnyOfAllOfAttributesC(Pet o) { + this(); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfAttributesC(Order o) { + this(); + setActualInstance(o); + } + static { schemas.put("Pet", Pet.class); schemas.put("Order", Order.class); @@ -216,6 +226,15 @@ public Pet getPet() throws ClassCastException { return (Pet)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Pet`. + * + * @return true if the actual instance is of the type `Pet` + */ + public boolean isPet() { + return super.getActualInstance() instanceof Pet; + } + /** * Get the actual instance of `Order`. If the actual instance is not `Order`, * the ClassCastException will be thrown. @@ -228,6 +247,15 @@ public Order getOrder() throws ClassCastException { return (Order)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Order`. + * + * @return true if the actual instance is of the type `Order` + */ + public boolean isOrder() { + return super.getActualInstance() instanceof Order; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java index f5f4762e7f56..2dfeb3c2891c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/AllOfModelArrayAnyOfAllOfLinkListColumn1Value.java @@ -151,6 +151,16 @@ public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Object o) { setActualInstance(o); } + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(User o) { + this(); + setActualInstance(o); + } + + public AllOfModelArrayAnyOfAllOfLinkListColumn1Value(Tag o) { + this(); + setActualInstance(o); + } + static { schemas.put("User", User.class); schemas.put("Tag", Tag.class); @@ -206,6 +216,15 @@ public User getUser() throws ClassCastException { return (User)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `User`. + * + * @return true if the actual instance is of the type `User` + */ + public boolean isUser() { + return super.getActualInstance() instanceof User; + } + /** * Get the actual instance of `Tag`. If the actual instance is not `Tag`, * the ClassCastException will be thrown. @@ -217,6 +236,15 @@ public Tag getTag() throws ClassCastException { return (Tag)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Tag`. + * + * @return true if the actual instance is of the type `Tag` + */ + public boolean isTag() { + return super.getActualInstance() instanceof Tag; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java index 74da050c2c33..976862187c72 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayAnyOf.java @@ -156,6 +156,16 @@ public ArrayAnyOf(Object o) { setActualInstance(o); } + public ArrayAnyOf(Integer o) { + this(); + setActualInstance(o); + } + + public ArrayAnyOf(List o) { + this(); + setActualInstance(o); + } + static { schemas.put("Integer", Integer.class); schemas.put("List", List.class); @@ -214,6 +224,15 @@ public Integer getInteger() throws ClassCastException { return (Integer)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Integer`. + * + * @return true if the actual instance is of the type `Integer` + */ + public boolean isInteger() { + return super.getActualInstance() instanceof Integer; + } + /** * Get the actual instance of `List<String>`. If the actual instance is not `List<String>`, * the ClassCastException will be thrown. diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOneOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOneOf.java index c3a0de6127d4..8ecb1d85b19c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOneOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ArrayOneOf.java @@ -161,6 +161,16 @@ public ArrayOneOf(Object o) { setActualInstance(o); } + public ArrayOneOf(Integer o) { + this(); + setActualInstance(o); + } + + public ArrayOneOf(List o) { + this(); + setActualInstance(o); + } + static { schemas.put("Integer", Integer.class); schemas.put("List", List.class); @@ -220,6 +230,15 @@ public Integer getInteger() throws ClassCastException { return (Integer)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Integer`. + * + * @return true if the actual instance is of the type `Integer` + */ + public boolean isInteger() { + return super.getActualInstance() instanceof Integer; + } + /** * Get the actual instance of `List<String>`. If the actual instance is not `List<String>`, * the ClassCastException will be thrown. diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java index bc6abb05d483..6a2a161fffab 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeAnyOfWIthSameErasureGet200Response.java @@ -137,6 +137,11 @@ public FakeAnyOfWIthSameErasureGet200Response(Object o) { setActualInstance(o); } + public FakeAnyOfWIthSameErasureGet200Response(List o) { + this(); + setActualInstance(o); + } + static { schemas.put("List", List.class); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java index 3fb7cc820635..878bc6ce8505 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeOneOfWIthSameErasureGet200Response.java @@ -143,6 +143,11 @@ public FakeOneOfWIthSameErasureGet200Response(Object o) { setActualInstance(o); } + public FakeOneOfWIthSameErasureGet200Response(List o) { + this(); + setActualInstance(o); + } + static { schemas.put("List", List.class); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java index 405519f04d86..7ebd7ee404f1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FakeRefParameterPetIdParameter.java @@ -150,6 +150,16 @@ public FakeRefParameterPetIdParameter(Object o) { setActualInstance(o); } + public FakeRefParameterPetIdParameter(String o) { + this(); + setActualInstance(o); + } + + public FakeRefParameterPetIdParameter(Integer o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Integer", Integer.class); @@ -206,6 +216,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Integer`. If the actual instance is not `Integer`, * the ClassCastException will be thrown. @@ -218,6 +237,15 @@ public Integer getInteger() throws ClassCastException { return (Integer)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Integer`. + * + * @return true if the actual instance is of the type `Integer` + */ + public boolean isInteger() { + return super.getActualInstance() instanceof Integer; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java index a20fc1708f12..2f3f64e02f43 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FreeFormObjectTestClassProperties.java @@ -153,6 +153,11 @@ public FreeFormObjectTestClassProperties(Object o) { setActualInstance(o); } + public FreeFormObjectTestClassProperties(String o) { + this(); + setActualInstance(o); + } + static { schemas.put("String", String.class); schemas.put("Map", Map.class); @@ -209,6 +214,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `Map<String, Object>`. If the actual instance is not `Map<String, Object>`, * the ClassCastException will be thrown. diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Fruit.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Fruit.java index cf6fde24c1d4..0bb63c80f7d5 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Fruit.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Fruit.java @@ -156,6 +156,16 @@ public Fruit(Object o) { setActualInstance(o); } + public Fruit(Apple o) { + this(); + setActualInstance(o); + } + + public Fruit(Banana o) { + this(); + setActualInstance(o); + } + static { schemas.put("Apple", Apple.class); schemas.put("Banana", Banana.class); @@ -212,6 +222,15 @@ public Apple getApple() throws ClassCastException { return (Apple)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Apple`. + * + * @return true if the actual instance is of the type `Apple` + */ + public boolean isApple() { + return super.getActualInstance() instanceof Apple; + } + /** * Get the actual instance of `Banana`. If the actual instance is not `Banana`, * the ClassCastException will be thrown. @@ -224,6 +243,15 @@ public Banana getBanana() throws ClassCastException { return (Banana)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Banana`. + * + * @return true if the actual instance is of the type `Banana` + */ + public boolean isBanana() { + return super.getActualInstance() instanceof Banana; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FruitReq.java index 5ab0527048a9..afca0b792aa8 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FruitReq.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FruitReq.java @@ -156,6 +156,16 @@ public FruitReq(Object o) { setActualInstance(o); } + public FruitReq(AppleReq o) { + this(); + setActualInstance(o); + } + + public FruitReq(BananaReq o) { + this(); + setActualInstance(o); + } + static { schemas.put("AppleReq", AppleReq.class); schemas.put("BananaReq", BananaReq.class); @@ -217,6 +227,15 @@ public AppleReq getAppleReq() throws ClassCastException { return (AppleReq)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `AppleReq`. + * + * @return true if the actual instance is of the type `AppleReq` + */ + public boolean isAppleReq() { + return super.getActualInstance() instanceof AppleReq; + } + /** * Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`, * the ClassCastException will be thrown. @@ -229,6 +248,15 @@ public BananaReq getBananaReq() throws ClassCastException { return (BananaReq)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `BananaReq`. + * + * @return true if the actual instance is of the type `BananaReq` + */ + public boolean isBananaReq() { + return super.getActualInstance() instanceof BananaReq; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GmFruit.java index 8feca027d028..c96839c8b1d1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GmFruit.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/GmFruit.java @@ -151,6 +151,16 @@ public GmFruit(Object o) { setActualInstance(o); } + public GmFruit(Apple o) { + this(); + setActualInstance(o); + } + + public GmFruit(Banana o) { + this(); + setActualInstance(o); + } + static { schemas.put("Apple", Apple.class); schemas.put("Banana", Banana.class); @@ -206,6 +216,15 @@ public Apple getApple() throws ClassCastException { return (Apple)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Apple`. + * + * @return true if the actual instance is of the type `Apple` + */ + public boolean isApple() { + return super.getActualInstance() instanceof Apple; + } + /** * Get the actual instance of `Banana`. If the actual instance is not `Banana`, * the ClassCastException will be thrown. @@ -217,6 +236,15 @@ public Banana getBanana() throws ClassCastException { return (Banana)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Banana`. + * + * @return true if the actual instance is of the type `Banana` + */ + public boolean isBanana() { + return super.getActualInstance() instanceof Banana; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Mammal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Mammal.java index 38ef8c6df8ae..c75b34950ac4 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Mammal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Mammal.java @@ -201,6 +201,21 @@ public Mammal(Object o) { setActualInstance(o); } + public Mammal(Whale o) { + this(); + setActualInstance(o); + } + + public Mammal(Zebra o) { + this(); + setActualInstance(o); + } + + public Mammal(Pig o) { + this(); + setActualInstance(o); + } + static { schemas.put("Whale", Whale.class); schemas.put("Zebra", Zebra.class); @@ -263,6 +278,15 @@ public Whale getWhale() throws ClassCastException { return (Whale)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Whale`. + * + * @return true if the actual instance is of the type `Whale` + */ + public boolean isWhale() { + return super.getActualInstance() instanceof Whale; + } + /** * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, * the ClassCastException will be thrown. @@ -275,6 +299,15 @@ public Zebra getZebra() throws ClassCastException { return (Zebra)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Zebra`. + * + * @return true if the actual instance is of the type `Zebra` + */ + public boolean isZebra() { + return super.getActualInstance() instanceof Zebra; + } + /** * Get the actual instance of `Pig`. If the actual instance is not `Pig`, * the ClassCastException will be thrown. @@ -287,6 +320,15 @@ public Pig getPig() throws ClassCastException { return (Pig)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Pig`. + * + * @return true if the actual instance is of the type `Pig` + */ + public boolean isPig() { + return super.getActualInstance() instanceof Pig; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MammalAnyof.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MammalAnyof.java index c50fd0d5e702..09d48f5c080b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MammalAnyof.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MammalAnyof.java @@ -201,6 +201,21 @@ public MammalAnyof(Object o) { setActualInstance(o); } + public MammalAnyof(Whale o) { + this(); + setActualInstance(o); + } + + public MammalAnyof(Zebra o) { + this(); + setActualInstance(o); + } + + public MammalAnyof(Pig o) { + this(); + setActualInstance(o); + } + static { schemas.put("Whale", Whale.class); schemas.put("Zebra", Zebra.class); @@ -262,6 +277,15 @@ public Whale getWhale() throws ClassCastException { return (Whale)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Whale`. + * + * @return true if the actual instance is of the type `Whale` + */ + public boolean isWhale() { + return super.getActualInstance() instanceof Whale; + } + /** * Get the actual instance of `Zebra`. If the actual instance is not `Zebra`, * the ClassCastException will be thrown. @@ -273,6 +297,15 @@ public Zebra getZebra() throws ClassCastException { return (Zebra)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Zebra`. + * + * @return true if the actual instance is of the type `Zebra` + */ + public boolean isZebra() { + return super.getActualInstance() instanceof Zebra; + } + /** * Get the actual instance of `Pig`. If the actual instance is not `Pig`, * the ClassCastException will be thrown. @@ -284,6 +317,15 @@ public Pig getPig() throws ClassCastException { return (Pig)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Pig`. + * + * @return true if the actual instance is of the type `Pig` + */ + public boolean isPig() { + return super.getActualInstance() instanceof Pig; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java index 9655bccc6312..1d9f67e87e20 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableFieldsMapResponse.java @@ -153,6 +153,16 @@ public NullableFieldsMapResponse(Object o) { setActualInstance(o); } + public NullableFieldsMapResponse(NullableFieldsMapSuccess o) { + this(); + setActualInstance(o); + } + + public NullableFieldsMapResponse(NullableFieldsMapError o) { + this(); + setActualInstance(o); + } + static { schemas.put("NullableFieldsMapSuccess", NullableFieldsMapSuccess.class); schemas.put("NullableFieldsMapError", NullableFieldsMapError.class); @@ -208,6 +218,15 @@ public NullableFieldsMapSuccess getNullableFieldsMapSuccess() throws ClassCastEx return (NullableFieldsMapSuccess)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `NullableFieldsMapSuccess`. + * + * @return true if the actual instance is of the type `NullableFieldsMapSuccess` + */ + public boolean isNullableFieldsMapSuccess() { + return super.getActualInstance() instanceof NullableFieldsMapSuccess; + } + /** * Get the actual instance of `NullableFieldsMapError`. If the actual instance is not `NullableFieldsMapError`, * the ClassCastException will be thrown. @@ -219,6 +238,15 @@ public NullableFieldsMapError getNullableFieldsMapError() throws ClassCastExcept return (NullableFieldsMapError)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `NullableFieldsMapError`. + * + * @return true if the actual instance is of the type `NullableFieldsMapError` + */ + public boolean isNullableFieldsMapError() { + return super.getActualInstance() instanceof NullableFieldsMapError; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableShape.java index 297e30173109..ca72b58dd40e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableShape.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NullableShape.java @@ -177,6 +177,16 @@ public NullableShape(Object o) { setActualInstance(o); } + public NullableShape(Triangle o) { + this(); + setActualInstance(o); + } + + public NullableShape(Quadrilateral o) { + this(); + setActualInstance(o); + } + static { schemas.put("Triangle", Triangle.class); schemas.put("Quadrilateral", Quadrilateral.class); @@ -238,6 +248,15 @@ public Triangle getTriangle() throws ClassCastException { return (Triangle)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Triangle`. + * + * @return true if the actual instance is of the type `Triangle` + */ + public boolean isTriangle() { + return super.getActualInstance() instanceof Triangle; + } + /** * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, * the ClassCastException will be thrown. @@ -250,6 +269,15 @@ public Quadrilateral getQuadrilateral() throws ClassCastException { return (Quadrilateral)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Quadrilateral`. + * + * @return true if the actual instance is of the type `Quadrilateral` + */ + public boolean isQuadrilateral() { + return super.getActualInstance() instanceof Quadrilateral; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pig.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pig.java index b0b56db6cccb..12339a03d188 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pig.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pig.java @@ -177,6 +177,16 @@ public Pig(Object o) { setActualInstance(o); } + public Pig(BasquePig o) { + this(); + setActualInstance(o); + } + + public Pig(DanishPig o) { + this(); + setActualInstance(o); + } + static { schemas.put("BasquePig", BasquePig.class); schemas.put("DanishPig", DanishPig.class); @@ -233,6 +243,15 @@ public BasquePig getBasquePig() throws ClassCastException { return (BasquePig)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `BasquePig`. + * + * @return true if the actual instance is of the type `BasquePig` + */ + public boolean isBasquePig() { + return super.getActualInstance() instanceof BasquePig; + } + /** * Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`, * the ClassCastException will be thrown. @@ -245,6 +264,15 @@ public DanishPig getDanishPig() throws ClassCastException { return (DanishPig)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `DanishPig`. + * + * @return true if the actual instance is of the type `DanishPig` + */ + public boolean isDanishPig() { + return super.getActualInstance() instanceof DanishPig; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Quadrilateral.java index 56dcb6ad2dc2..08fe434c8d00 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Quadrilateral.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -177,6 +177,16 @@ public Quadrilateral(Object o) { setActualInstance(o); } + public Quadrilateral(SimpleQuadrilateral o) { + this(); + setActualInstance(o); + } + + public Quadrilateral(ComplexQuadrilateral o) { + this(); + setActualInstance(o); + } + static { schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class); schemas.put("ComplexQuadrilateral", ComplexQuadrilateral.class); @@ -233,6 +243,15 @@ public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException { return (SimpleQuadrilateral)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `SimpleQuadrilateral`. + * + * @return true if the actual instance is of the type `SimpleQuadrilateral` + */ + public boolean isSimpleQuadrilateral() { + return super.getActualInstance() instanceof SimpleQuadrilateral; + } + /** * Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`, * the ClassCastException will be thrown. @@ -245,6 +264,15 @@ public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException return (ComplexQuadrilateral)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `ComplexQuadrilateral`. + * + * @return true if the actual instance is of the type `ComplexQuadrilateral` + */ + public boolean isComplexQuadrilateral() { + return super.getActualInstance() instanceof ComplexQuadrilateral; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Scalar.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Scalar.java index e64042c9706b..9f5ccb5001d2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Scalar.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Scalar.java @@ -192,6 +192,26 @@ public Scalar(Object o) { setActualInstance(o); } + public Scalar(UUID o) { + this(); + setActualInstance(o); + } + + public Scalar(String o) { + this(); + setActualInstance(o); + } + + public Scalar(BigDecimal o) { + this(); + setActualInstance(o); + } + + public Scalar(Boolean o) { + this(); + setActualInstance(o); + } + static { schemas.put("UUID", UUID.class); schemas.put("String", String.class); @@ -260,6 +280,15 @@ public UUID getUUID() throws ClassCastException { return (UUID)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `UUID`. + * + * @return true if the actual instance is of the type `UUID` + */ + public boolean isUUID() { + return super.getActualInstance() instanceof UUID; + } + /** * Get the actual instance of `String`. If the actual instance is not `String`, * the ClassCastException will be thrown. @@ -272,6 +301,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, * the ClassCastException will be thrown. @@ -284,6 +322,15 @@ public BigDecimal getBigDecimal() throws ClassCastException { return (BigDecimal)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `BigDecimal`. + * + * @return true if the actual instance is of the type `BigDecimal` + */ + public boolean isBigDecimal() { + return super.getActualInstance() instanceof BigDecimal; + } + /** * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, * the ClassCastException will be thrown. @@ -296,6 +343,15 @@ public Boolean getBoolean() throws ClassCastException { return (Boolean)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Boolean`. + * + * @return true if the actual instance is of the type `Boolean` + */ + public boolean isBoolean() { + return super.getActualInstance() instanceof Boolean; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java index 96bd356790ca..f360db82fc6b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ScalarAnyOf.java @@ -189,6 +189,26 @@ public ScalarAnyOf(Object o) { setActualInstance(o); } + public ScalarAnyOf(UUID o) { + this(); + setActualInstance(o); + } + + public ScalarAnyOf(String o) { + this(); + setActualInstance(o); + } + + public ScalarAnyOf(BigDecimal o) { + this(); + setActualInstance(o); + } + + public ScalarAnyOf(Boolean o) { + this(); + setActualInstance(o); + } + static { schemas.put("UUID", UUID.class); schemas.put("String", String.class); @@ -256,6 +276,15 @@ public UUID getUUID() throws ClassCastException { return (UUID)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `UUID`. + * + * @return true if the actual instance is of the type `UUID` + */ + public boolean isUUID() { + return super.getActualInstance() instanceof UUID; + } + /** * Get the actual instance of `String`. If the actual instance is not `String`, * the ClassCastException will be thrown. @@ -267,6 +296,15 @@ public String getString() throws ClassCastException { return (String)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `String`. + * + * @return true if the actual instance is of the type `String` + */ + public boolean isString() { + return super.getActualInstance() instanceof String; + } + /** * Get the actual instance of `BigDecimal`. If the actual instance is not `BigDecimal`, * the ClassCastException will be thrown. @@ -278,6 +316,15 @@ public BigDecimal getBigDecimal() throws ClassCastException { return (BigDecimal)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `BigDecimal`. + * + * @return true if the actual instance is of the type `BigDecimal` + */ + public boolean isBigDecimal() { + return super.getActualInstance() instanceof BigDecimal; + } + /** * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, * the ClassCastException will be thrown. @@ -289,6 +336,15 @@ public Boolean getBoolean() throws ClassCastException { return (Boolean)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Boolean`. + * + * @return true if the actual instance is of the type `Boolean` + */ + public boolean isBoolean() { + return super.getActualInstance() instanceof Boolean; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Shape.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Shape.java index cc54a5edd746..c1d22ee77c1c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Shape.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Shape.java @@ -177,6 +177,16 @@ public Shape(Object o) { setActualInstance(o); } + public Shape(Triangle o) { + this(); + setActualInstance(o); + } + + public Shape(Quadrilateral o) { + this(); + setActualInstance(o); + } + static { schemas.put("Triangle", Triangle.class); schemas.put("Quadrilateral", Quadrilateral.class); @@ -233,6 +243,15 @@ public Triangle getTriangle() throws ClassCastException { return (Triangle)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Triangle`. + * + * @return true if the actual instance is of the type `Triangle` + */ + public boolean isTriangle() { + return super.getActualInstance() instanceof Triangle; + } + /** * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, * the ClassCastException will be thrown. @@ -245,6 +264,15 @@ public Quadrilateral getQuadrilateral() throws ClassCastException { return (Quadrilateral)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Quadrilateral`. + * + * @return true if the actual instance is of the type `Quadrilateral` + */ + public boolean isQuadrilateral() { + return super.getActualInstance() instanceof Quadrilateral; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeOrNull.java index c1cd3803fd1d..aa9f4af3b94f 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeOrNull.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -177,6 +177,16 @@ public ShapeOrNull(Object o) { setActualInstance(o); } + public ShapeOrNull(Triangle o) { + this(); + setActualInstance(o); + } + + public ShapeOrNull(Quadrilateral o) { + this(); + setActualInstance(o); + } + static { schemas.put("Triangle", Triangle.class); schemas.put("Quadrilateral", Quadrilateral.class); @@ -238,6 +248,15 @@ public Triangle getTriangle() throws ClassCastException { return (Triangle)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Triangle`. + * + * @return true if the actual instance is of the type `Triangle` + */ + public boolean isTriangle() { + return super.getActualInstance() instanceof Triangle; + } + /** * Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`, * the ClassCastException will be thrown. @@ -250,6 +269,15 @@ public Quadrilateral getQuadrilateral() throws ClassCastException { return (Quadrilateral)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Quadrilateral`. + * + * @return true if the actual instance is of the type `Quadrilateral` + */ + public boolean isQuadrilateral() { + return super.getActualInstance() instanceof Quadrilateral; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Triangle.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Triangle.java index 9f32762e7a8f..6e7f0aa18514 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Triangle.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Triangle.java @@ -201,6 +201,21 @@ public Triangle(Object o) { setActualInstance(o); } + public Triangle(EquilateralTriangle o) { + this(); + setActualInstance(o); + } + + public Triangle(IsoscelesTriangle o) { + this(); + setActualInstance(o); + } + + public Triangle(ScaleneTriangle o) { + this(); + setActualInstance(o); + } + static { schemas.put("EquilateralTriangle", EquilateralTriangle.class); schemas.put("IsoscelesTriangle", IsoscelesTriangle.class); @@ -263,6 +278,15 @@ public EquilateralTriangle getEquilateralTriangle() throws ClassCastException { return (EquilateralTriangle)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `EquilateralTriangle`. + * + * @return true if the actual instance is of the type `EquilateralTriangle` + */ + public boolean isEquilateralTriangle() { + return super.getActualInstance() instanceof EquilateralTriangle; + } + /** * Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`, * the ClassCastException will be thrown. @@ -275,6 +299,15 @@ public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException { return (IsoscelesTriangle)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `IsoscelesTriangle`. + * + * @return true if the actual instance is of the type `IsoscelesTriangle` + */ + public boolean isIsoscelesTriangle() { + return super.getActualInstance() instanceof IsoscelesTriangle; + } + /** * Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`, * the ClassCastException will be thrown. @@ -287,6 +320,15 @@ public ScaleneTriangle getScaleneTriangle() throws ClassCastException { return (ScaleneTriangle)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `ScaleneTriangle`. + * + * @return true if the actual instance is of the type `ScaleneTriangle` + */ + public boolean isScaleneTriangle() { + return super.getActualInstance() instanceof ScaleneTriangle; + } + /** * Validates the JSON Element and throws an exception if issues found * diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Value.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Value.java index db32b734aa75..fbd565d4ef18 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Value.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Value.java @@ -161,6 +161,16 @@ public Value(Object o) { setActualInstance(o); } + public Value(Scalar o) { + this(); + setActualInstance(o); + } + + public Value(List o) { + this(); + setActualInstance(o); + } + static { schemas.put("Scalar", Scalar.class); schemas.put("List", List.class); @@ -220,6 +230,15 @@ public Scalar getScalar() throws ClassCastException { return (Scalar)super.getActualInstance(); } + /** + * Check if the actual instance is of the type `Scalar`. + * + * @return true if the actual instance is of the type `Scalar` + */ + public boolean isScalar() { + return super.getActualInstance() instanceof Scalar; + } + /** * Get the actual instance of `List<Scalar>`. If the actual instance is not `List<Scalar>`, * the ClassCastException will be thrown.