[java][native] Fix urlQuery string method in oneOf (#14488)

* better tests, fix oneOf in urlquery string method

* update samples

* update
This commit is contained in:
William Cheng 2023-01-20 01:57:32 +08:00 committed by GitHub
parent 6e780218ad
commit 4ecb9f4186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
230 changed files with 23706 additions and 1753 deletions

View File

@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/native-async
library: native
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-native

View File

@ -1,7 +1,7 @@
generatorName: java
outputDir: samples/client/petstore/java/native
library: native
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-native

View File

@ -372,7 +372,7 @@ public class {{classname}} {
{{/hasVars}}
{{^hasVars}}
{{#isModel}}
localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString(null));
localVarQueryStringJoiner.add({{paramName}}.toUrlQueryString());
{{/isModel}}
{{^isModel}}
localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}}));

View File

@ -228,4 +228,166 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
}
{{/oneOf}}
{{#supportUrlQuery}}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
{{#composedSchemas.oneOf}}
if (getActualInstance() instanceof {{{dataType}}}) {
{{#isArray}}
{{#items.isPrimitiveType}}
{{#uniqueItems}}
if (getActualInstance() != null) {
int i = 0;
for ({{items.dataType}} _item : ({{{dataType}}})getActualInstance()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
i++;
}
{{/uniqueItems}}
{{^uniqueItems}}
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getActualInstance().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
{{/uniqueItems}}
{{/items.isPrimitiveType}}
{{^items.isPrimitiveType}}
{{#items.isModel}}
{{#uniqueItems}}
if (getActualInstance() != null) {
int i = 0;
for ({{items.dataType}} _item : ({{{dataType}}})getActualInstance()) {
if ((({{{dataType}}})getActualInstance()).get(i) != null) {
joiner.add(_item.toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
i++;
}
{{/uniqueItems}}
{{^uniqueItems}}
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
if ((({{{dataType}}})getActualInstance()).get(i) != null) {
joiner.add((({{{items.dataType}}})getActualInstance()).get(i).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
{{/uniqueItems}}
{{/items.isModel}}
{{^items.isModel}}
{{#uniqueItems}}
if (getActualInstance() != null) {
int i = 0;
for ({{items.dataType}} _item : ({{{dataType}}})getActualInstance()) {
if (_item != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix)),
URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20"));
}
i++;
}
}
{{/uniqueItems}}
{{^uniqueItems}}
if (getActualInstance() != null) {
for (int i = 0; i < (({{{dataType}}})getActualInstance()).size(); i++) {
if (getActualInstance().get(i) != null) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf((({{{dataType}}})getActualInstance()).get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
}
{{/uniqueItems}}
{{/items.isModel}}
{{/items.isPrimitiveType}}
{{/isArray}}
{{^isArray}}
{{#isMap}}
{{#items.isPrimitiveType}}
if (getActualInstance() != null) {
for (String _key : (({{{dataType}}})getActualInstance()).keySet()) {
joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
getActualInstance().get(_key), URLEncoder.encode(String.valueOf((({{{dataType}}})getActualInstance()).get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
{{/items.isPrimitiveType}}
{{^items.isPrimitiveType}}
if (getActualInstance() != null) {
for (String _key : (({{{dataType}}})getActualInstance()).keySet()) {
if ((({{{dataType}}})getActualInstance()).get(_key) != null) {
joiner.add((({{{items.dataType}}})getActualInstance()).get(_key).toUrlQueryString(String.format("%s{{baseName}}%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
}
}
}
{{/items.isPrimitiveType}}
{{/isMap}}
{{^isMap}}
{{#isPrimitiveType}}
if (getActualInstance() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isModel}}
if (getActualInstance() != null) {
joiner.add((({{{dataType}}})getActualInstance()).toUrlQueryString(prefix + "{{{baseName}}}" + suffix));
}
{{/isModel}}
{{^isModel}}
if (getActualInstance() != null) {
joiner.add(String.format("%s{{{baseName}}}%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
{{/isModel}}
{{/isPrimitiveType}}
{{/isMap}}
{{/isArray}}
return joiner.toString();
}
{{/composedSchemas.oneOf}}
return null;
}
{{/supportUrlQuery}}
}

View File

@ -610,7 +610,7 @@ public class QueryApi {
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_object";
localVarQueryStringJoiner.add(queryObject.toUrlQueryString(null));
localVarQueryStringJoiner.add(queryObject.toUrlQueryString());
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");

View File

@ -6,33 +6,49 @@ api/openapi.yaml
build.gradle
build.sbt
docs/AdditionalPropertiesClass.md
docs/AllOfWithSingleRef.md
docs/Animal.md
docs/AnotherFakeApi.md
docs/Apple.md
docs/AppleReq.md
docs/ArrayOfArrayOfNumberOnly.md
docs/ArrayOfNumberOnly.md
docs/ArrayTest.md
docs/Banana.md
docs/BananaReq.md
docs/BasquePig.md
docs/Capitalization.md
docs/Cat.md
docs/CatAllOf.md
docs/Category.md
docs/ChildCat.md
docs/ChildCatAllOf.md
docs/ClassModel.md
docs/Client.md
docs/ComplexQuadrilateral.md
docs/DanishPig.md
docs/DefaultApi.md
docs/DeprecatedObject.md
docs/Dog.md
docs/DogAllOf.md
docs/Drawing.md
docs/EnumArrays.md
docs/EnumClass.md
docs/EnumTest.md
docs/EquilateralTriangle.md
docs/FakeApi.md
docs/FakeClassnameTags123Api.md
docs/FileSchemaTestClass.md
docs/Foo.md
docs/FooGetDefaultResponse.md
docs/FormatTest.md
docs/Fruit.md
docs/FruitReq.md
docs/GmFruit.md
docs/GrandparentAnimal.md
docs/HasOnlyReadOnly.md
docs/HealthCheckResult.md
docs/IsoscelesTriangle.md
docs/Mammal.md
docs/MapTest.md
docs/MixedPropertiesAndAdditionalPropertiesClass.md
docs/Model200Response.md
@ -42,6 +58,7 @@ docs/ModelList.md
docs/ModelReturn.md
docs/Name.md
docs/NullableClass.md
docs/NullableShape.md
docs/NumberOnly.md
docs/ObjectWithDeprecatedFields.md
docs/Order.md
@ -50,16 +67,27 @@ docs/OuterEnum.md
docs/OuterEnumDefaultValue.md
docs/OuterEnumInteger.md
docs/OuterEnumIntegerDefaultValue.md
docs/OuterObjectWithEnumProperty.md
docs/ParentPet.md
docs/Pet.md
docs/PetApi.md
docs/Pig.md
docs/Quadrilateral.md
docs/QuadrilateralInterface.md
docs/ReadOnlyFirst.md
docs/SingleRefType.md
docs/ScaleneTriangle.md
docs/Shape.md
docs/ShapeInterface.md
docs/ShapeOrNull.md
docs/SimpleQuadrilateral.md
docs/SpecialModelName.md
docs/StoreApi.md
docs/Tag.md
docs/Triangle.md
docs/TriangleInterface.md
docs/User.md
docs/UserApi.md
docs/Whale.md
docs/Zebra.md
git_push.sh
gradle.properties
gradle/wrapper/gradle-wrapper.jar
@ -87,29 +115,45 @@ src/main/java/org/openapitools/client/api/StoreApi.java
src/main/java/org/openapitools/client/api/UserApi.java
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java
src/main/java/org/openapitools/client/model/AllOfWithSingleRef.java
src/main/java/org/openapitools/client/model/Animal.java
src/main/java/org/openapitools/client/model/Apple.java
src/main/java/org/openapitools/client/model/AppleReq.java
src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayTest.java
src/main/java/org/openapitools/client/model/Banana.java
src/main/java/org/openapitools/client/model/BananaReq.java
src/main/java/org/openapitools/client/model/BasquePig.java
src/main/java/org/openapitools/client/model/Capitalization.java
src/main/java/org/openapitools/client/model/Cat.java
src/main/java/org/openapitools/client/model/CatAllOf.java
src/main/java/org/openapitools/client/model/Category.java
src/main/java/org/openapitools/client/model/ChildCat.java
src/main/java/org/openapitools/client/model/ChildCatAllOf.java
src/main/java/org/openapitools/client/model/ClassModel.java
src/main/java/org/openapitools/client/model/Client.java
src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java
src/main/java/org/openapitools/client/model/DanishPig.java
src/main/java/org/openapitools/client/model/DeprecatedObject.java
src/main/java/org/openapitools/client/model/Dog.java
src/main/java/org/openapitools/client/model/DogAllOf.java
src/main/java/org/openapitools/client/model/Drawing.java
src/main/java/org/openapitools/client/model/EnumArrays.java
src/main/java/org/openapitools/client/model/EnumClass.java
src/main/java/org/openapitools/client/model/EnumTest.java
src/main/java/org/openapitools/client/model/EquilateralTriangle.java
src/main/java/org/openapitools/client/model/FileSchemaTestClass.java
src/main/java/org/openapitools/client/model/Foo.java
src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java
src/main/java/org/openapitools/client/model/FormatTest.java
src/main/java/org/openapitools/client/model/Fruit.java
src/main/java/org/openapitools/client/model/FruitReq.java
src/main/java/org/openapitools/client/model/GmFruit.java
src/main/java/org/openapitools/client/model/GrandparentAnimal.java
src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java
src/main/java/org/openapitools/client/model/HealthCheckResult.java
src/main/java/org/openapitools/client/model/IsoscelesTriangle.java
src/main/java/org/openapitools/client/model/Mammal.java
src/main/java/org/openapitools/client/model/MapTest.java
src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
src/main/java/org/openapitools/client/model/Model200Response.java
@ -119,6 +163,7 @@ src/main/java/org/openapitools/client/model/ModelList.java
src/main/java/org/openapitools/client/model/ModelReturn.java
src/main/java/org/openapitools/client/model/Name.java
src/main/java/org/openapitools/client/model/NullableClass.java
src/main/java/org/openapitools/client/model/NullableShape.java
src/main/java/org/openapitools/client/model/NumberOnly.java
src/main/java/org/openapitools/client/model/ObjectWithDeprecatedFields.java
src/main/java/org/openapitools/client/model/Order.java
@ -127,10 +172,21 @@ src/main/java/org/openapitools/client/model/OuterEnum.java
src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java
src/main/java/org/openapitools/client/model/OuterEnumInteger.java
src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java
src/main/java/org/openapitools/client/model/OuterObjectWithEnumProperty.java
src/main/java/org/openapitools/client/model/ParentPet.java
src/main/java/org/openapitools/client/model/Pet.java
src/main/java/org/openapitools/client/model/Pig.java
src/main/java/org/openapitools/client/model/Quadrilateral.java
src/main/java/org/openapitools/client/model/QuadrilateralInterface.java
src/main/java/org/openapitools/client/model/ReadOnlyFirst.java
src/main/java/org/openapitools/client/model/SingleRefType.java
src/main/java/org/openapitools/client/model/ScaleneTriangle.java
src/main/java/org/openapitools/client/model/Shape.java
src/main/java/org/openapitools/client/model/ShapeInterface.java
src/main/java/org/openapitools/client/model/ShapeOrNull.java
src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java
src/main/java/org/openapitools/client/model/SpecialModelName.java
src/main/java/org/openapitools/client/model/Tag.java
src/main/java/org/openapitools/client/model/Triangle.java
src/main/java/org/openapitools/client/model/TriangleInterface.java
src/main/java/org/openapitools/client/model/User.java
src/main/java/org/openapitools/client/model/Whale.java
src/main/java/org/openapitools/client/model/Zebra.java

View File

@ -112,8 +112,6 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**fooGetWithHttpInfo**](docs/DefaultApi.md#fooGetWithHttpInfo) | **GET** /foo |
*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**fakeHealthGetWithHttpInfo**](docs/FakeApi.md#fakeHealthGetWithHttpInfo) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication
*FakeApi* | [**fakeHttpSignatureTestWithHttpInfo**](docs/FakeApi.md#fakeHttpSignatureTestWithHttpInfo) | **GET** /fake/http-signature-test | test http signature authentication
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fakeOuterBooleanSerializeWithHttpInfo**](docs/FakeApi.md#fakeOuterBooleanSerializeWithHttpInfo) | **POST** /fake/outer/boolean |
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
@ -122,10 +120,8 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fakeOuterNumberSerializeWithHttpInfo**](docs/FakeApi.md#fakeOuterNumberSerializeWithHttpInfo) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
*FakeApi* | [**fakeOuterStringSerializeWithHttpInfo**](docs/FakeApi.md#fakeOuterStringSerializeWithHttpInfo) | **POST** /fake/outer/string |
*FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int |
*FakeApi* | [**fakePropertyEnumIntegerSerializeWithHttpInfo**](docs/FakeApi.md#fakePropertyEnumIntegerSerializeWithHttpInfo) | **POST** /fake/property/enum-int |
*FakeApi* | [**testBodyWithBinary**](docs/FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary |
*FakeApi* | [**testBodyWithBinaryWithHttpInfo**](docs/FakeApi.md#testBodyWithBinaryWithHttpInfo) | **PUT** /fake/body-with-binary |
*FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums
*FakeApi* | [**getArrayOfEnumsWithHttpInfo**](docs/FakeApi.md#getArrayOfEnumsWithHttpInfo) | **GET** /fake/array-of-enums | Array of Enums
*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithFileSchemaWithHttpInfo**](docs/FakeApi.md#testBodyWithFileSchemaWithHttpInfo) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
@ -193,29 +189,45 @@ Class | Method | HTTP request | Description
## Documentation for Models
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [AllOfWithSingleRef](docs/AllOfWithSingleRef.md)
- [Animal](docs/Animal.md)
- [Apple](docs/Apple.md)
- [AppleReq](docs/AppleReq.md)
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [ArrayTest](docs/ArrayTest.md)
- [Banana](docs/Banana.md)
- [BananaReq](docs/BananaReq.md)
- [BasquePig](docs/BasquePig.md)
- [Capitalization](docs/Capitalization.md)
- [Cat](docs/Cat.md)
- [CatAllOf](docs/CatAllOf.md)
- [Category](docs/Category.md)
- [ChildCat](docs/ChildCat.md)
- [ChildCatAllOf](docs/ChildCatAllOf.md)
- [ClassModel](docs/ClassModel.md)
- [Client](docs/Client.md)
- [ComplexQuadrilateral](docs/ComplexQuadrilateral.md)
- [DanishPig](docs/DanishPig.md)
- [DeprecatedObject](docs/DeprecatedObject.md)
- [Dog](docs/Dog.md)
- [DogAllOf](docs/DogAllOf.md)
- [Drawing](docs/Drawing.md)
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)
- [EnumTest](docs/EnumTest.md)
- [EquilateralTriangle](docs/EquilateralTriangle.md)
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [Foo](docs/Foo.md)
- [FooGetDefaultResponse](docs/FooGetDefaultResponse.md)
- [FormatTest](docs/FormatTest.md)
- [Fruit](docs/Fruit.md)
- [FruitReq](docs/FruitReq.md)
- [GmFruit](docs/GmFruit.md)
- [GrandparentAnimal](docs/GrandparentAnimal.md)
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [HealthCheckResult](docs/HealthCheckResult.md)
- [IsoscelesTriangle](docs/IsoscelesTriangle.md)
- [Mammal](docs/Mammal.md)
- [MapTest](docs/MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model200Response](docs/Model200Response.md)
@ -225,6 +237,7 @@ Class | Method | HTTP request | Description
- [ModelReturn](docs/ModelReturn.md)
- [Name](docs/Name.md)
- [NullableClass](docs/NullableClass.md)
- [NullableShape](docs/NullableShape.md)
- [NumberOnly](docs/NumberOnly.md)
- [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
- [Order](docs/Order.md)
@ -233,13 +246,24 @@ Class | Method | HTTP request | Description
- [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
- [OuterEnumInteger](docs/OuterEnumInteger.md)
- [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
- [OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
- [ParentPet](docs/ParentPet.md)
- [Pet](docs/Pet.md)
- [Pig](docs/Pig.md)
- [Quadrilateral](docs/Quadrilateral.md)
- [QuadrilateralInterface](docs/QuadrilateralInterface.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [SingleRefType](docs/SingleRefType.md)
- [ScaleneTriangle](docs/ScaleneTriangle.md)
- [Shape](docs/Shape.md)
- [ShapeInterface](docs/ShapeInterface.md)
- [ShapeOrNull](docs/ShapeOrNull.md)
- [SimpleQuadrilateral](docs/SimpleQuadrilateral.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [Tag](docs/Tag.md)
- [Triangle](docs/Triangle.md)
- [TriangleInterface](docs/TriangleInterface.md)
- [User](docs/User.md)
- [Whale](docs/Whale.md)
- [Zebra](docs/Zebra.md)
## Documentation for Authorization

View File

@ -32,7 +32,7 @@ servers:
- v1
- v2
- description: The local server without variables
url: https://127.0.0.1/no_varaible
url: https://127.0.0.1/no_variable
tags:
- description: Everything about your Pets
name: pet
@ -58,11 +58,10 @@ paths:
requestBody:
$ref: '#/components/requestBodies/Pet'
responses:
"200":
description: Successful operation
"405":
description: Invalid input
security:
- http_signature_test: []
- petstore_auth:
- write:pets
- read:pets
@ -77,8 +76,6 @@ paths:
requestBody:
$ref: '#/components/requestBodies/Pet'
responses:
"200":
description: Successful operation
"400":
description: Invalid ID supplied
"404":
@ -86,33 +83,18 @@ paths:
"405":
description: Validation exception
security:
- http_signature_test: []
- petstore_auth:
- write:pets
- read:pets
summary: Update an existing pet
tags:
- pet
x-webclient-blocking: true
x-content-type: application/json
x-accepts: application/json
servers:
- url: http://petstore.swagger.io/v2
- url: http://path-server-test.petstore.local/v2
- description: test server with variables
url: "http://{server}.swagger.io:{port}/v2"
variables:
server:
default: petstore
description: target server
enum:
- petstore
- qa-petstore
- dev-petstore
port:
default: "80"
enum:
- "80"
- "8080"
/pet/findByStatus:
get:
description: Multiple status values can be provided with comma separated strings
@ -151,13 +133,13 @@ paths:
"400":
description: Invalid status value
security:
- http_signature_test: []
- petstore_auth:
- write:pets
- read:pets
summary: Finds Pets by status
tags:
- pet
x-webclient-blocking: true
x-accepts: application/json
/pet/findByTags:
get:
@ -175,7 +157,6 @@ paths:
items:
type: string
type: array
uniqueItems: true
style: form
responses:
"200":
@ -185,24 +166,22 @@ paths:
items:
$ref: '#/components/schemas/Pet'
type: array
uniqueItems: true
application/json:
schema:
items:
$ref: '#/components/schemas/Pet'
type: array
uniqueItems: true
description: successful operation
"400":
description: Invalid tag value
security:
- http_signature_test: []
- petstore_auth:
- write:pets
- read:pets
summary: Finds Pets by tags
tags:
- pet
x-webclient-blocking: true
x-accepts: application/json
/pet/{petId}:
delete:
@ -226,8 +205,6 @@ paths:
type: integer
style: simple
responses:
"200":
description: Successful operation
"400":
description: Invalid pet value
security:
@ -270,7 +247,6 @@ paths:
summary: Find pet by ID
tags:
- pet
x-webclient-blocking: true
x-accepts: application/json
post:
description: ""
@ -291,8 +267,6 @@ paths:
schema:
$ref: '#/components/schemas/updatePetWithForm_request'
responses:
"200":
description: Successful operation
"405":
description: Invalid input
security:
@ -358,7 +332,6 @@ paths:
summary: Returns pet inventories by status
tags:
- store
x-webclient-blocking: false
x-accepts: application/json
/store/order:
post:
@ -803,15 +776,6 @@ paths:
format: double
type: number
style: form
- explode: true
in: query
name: enum_query_model_array
required: false
schema:
items:
$ref: '#/components/schemas/EnumClass'
type: array
style: form
requestBody:
content:
application/x-www-form-urlencoded:
@ -893,28 +857,6 @@ paths:
- fake
x-content-type: application/json
x-accepts: '*/*'
/fake/property/enum-int:
post:
description: Test serialization of enum (int) properties with examples
operationId: fakePropertyEnumIntegerSerialize
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OuterObjectWithEnumProperty'
description: Input enum (int) as post body
required: true
responses:
"200":
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterObjectWithEnumProperty'
description: Output enum (int)
tags:
- fake
x-content-type: application/json
x-accepts: '*/*'
/fake/outer/string:
post:
description: Test serialization of outer string types
@ -1060,7 +1002,7 @@ paths:
x-accepts: application/json
/fake/body-with-file-schema:
put:
description: "For this test, the body for this request must reference a schema\
description: "For this test, the body for this request much reference a schema\
\ named `File`."
operationId: testBodyWithFileSchema
requestBody:
@ -1076,32 +1018,12 @@ paths:
- fake
x-content-type: application/json
x-accepts: application/json
/fake/body-with-binary:
put:
description: "For this test, the body has to be a binary file."
operationId: testBodyWithBinary
requestBody:
content:
image/png:
schema:
format: binary
nullable: true
type: string
description: image to upload
required: true
responses:
"200":
description: Success
tags:
- fake
x-content-type: image/png
x-accepts: application/json
/fake/test-query-parameters:
put:
description: To test the collection format in query parameters
operationId: testQueryParameterCollectionFormat
parameters:
- explode: false
- explode: true
in: query
name: pipe
required: true
@ -1109,7 +1031,7 @@ paths:
items:
type: string
type: array
style: pipeDelimited
style: form
- explode: false
in: query
name: ioutil
@ -1146,24 +1068,6 @@ paths:
type: string
type: array
style: form
- explode: true
in: query
name: language
required: false
schema:
additionalProperties:
format: string
type: string
type: object
style: form
- allowEmptyValue: true
explode: true
in: query
name: allowEmpty
required: true
schema:
type: string
style: form
responses:
"200":
description: Success
@ -1218,43 +1122,32 @@ paths:
tags:
- fake
x-accepts: application/json
/fake/http-signature-test:
/fake/array-of-enums:
get:
operationId: fake-http-signature-test
parameters:
- description: query parameter
explode: true
in: query
name: query_1
required: false
schema:
type: string
style: form
- description: header parameter
explode: false
in: header
name: header_1
required: false
schema:
type: string
style: simple
requestBody:
$ref: '#/components/requestBodies/Pet'
operationId: getArrayOfEnums
responses:
"200":
description: The instance started successfully
security:
- http_signature_test: []
summary: test http signature authentication
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfEnums'
description: Got named array of enums
summary: Array of Enums
tags:
- fake
x-content-type: application/json
x-accepts: application/json
components:
requestBodies:
UserArray:
content:
application/json:
examples:
simple-list:
description: Should not get into code examples
summary: Simple list example
value:
- username: foo
- username: bar
schema:
items:
$ref: '#/components/schemas/User'
@ -1295,7 +1188,7 @@ components:
petId: 6
quantity: 1
id: 0
shipDate: 2000-01-23T04:56:07.000+00:00
shipDate: 2020-02-02T20:20:20.000222Z
complete: false
status: placed
properties:
@ -1309,6 +1202,7 @@ components:
format: int32
type: integer
shipDate:
example: 2020-02-02T20:20:20.000222Z
format: date-time
type: string
status:
@ -1346,9 +1240,13 @@ components:
lastName: lastName
password: password
userStatus: 6
objectWithNoDeclaredPropsNullable: "{}"
phone: phone
objectWithNoDeclaredProps: "{}"
id: 0
anyTypePropNullable: ""
email: email
anyTypeProp: ""
username: username
properties:
id:
@ -1371,6 +1269,25 @@ components:
description: User Status
format: int32
type: integer
objectWithNoDeclaredProps:
description: test code generation for objects Value must be a map of strings
to values. It cannot be the 'null' value.
type: object
objectWithNoDeclaredPropsNullable:
description: test code generation for nullable objects. Value must be a
map of strings to values or the 'null' value.
nullable: true
type: object
anyTypeProp:
description: "test code generation for any type Here the 'type' attribute\
\ is not specified, which means the value can be anything, including the\
\ null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389"
anyTypePropNullable:
description: "test code generation for any type Here the 'type' attribute\
\ is not specified, which means the value can be anything, including the\
\ null value, string, number, boolean, array or object. The 'nullable'\
\ attribute does not change the allowed values."
nullable: true
type: object
xml:
name: User
@ -1417,7 +1334,6 @@ components:
items:
type: string
type: array
uniqueItems: true
xml:
name: photoUrl
wrapped: true
@ -1504,7 +1420,12 @@ components:
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- $ref: '#/components/schemas/Address'
- $ref: '#/components/schemas/Cat_allOf'
Address:
additionalProperties:
type: integer
type: object
Animal:
discriminator:
propertyName: className
@ -1526,6 +1447,7 @@ components:
integer:
maximum: 100
minimum: 10
multipleOf: 2
type: integer
int32:
format: int32
@ -1538,6 +1460,7 @@ components:
number:
maximum: 543.2
minimum: 32.1
multipleOf: 32.5
type: number
float:
format: float
@ -1562,9 +1485,11 @@ components:
format: binary
type: string
date:
example: 2020-02-02
format: date
type: string
dateTime:
example: 2007-12-03T10:15:30+01:00
format: date-time
type: string
uuid:
@ -1618,6 +1543,11 @@ components:
- -1
format: int32
type: integer
enum_integer_only:
enum:
- 2
- -2
type: integer
enum_number:
enum:
- 1.1
@ -1647,6 +1577,24 @@ components:
type: string
type: object
type: object
anytype_1: {}
map_with_undeclared_properties_anytype_1:
type: object
map_with_undeclared_properties_anytype_2:
properties: {}
type: object
map_with_undeclared_properties_anytype_3:
additionalProperties: true
type: object
empty_map:
additionalProperties: false
description: "an object with no declared properties and no undeclared properties,\
\ hence it's an empty map."
type: object
map_with_undeclared_properties_string:
additionalProperties:
type: string
type: object
type: object
MixedPropertiesAndAdditionalPropertiesClass:
properties:
@ -1736,8 +1684,6 @@ components:
array_of_string:
items:
type: string
maxItems: 3
minItems: 0
type: array
array_array_of_integer:
items:
@ -1801,7 +1747,6 @@ components:
- 0
- 1
- 2
example: 2
type: integer
OuterEnumDefaultValue:
default: placed
@ -1871,6 +1816,8 @@ components:
$special[property.name]:
format: int64
type: integer
_special_model.name_:
type: string
xml:
name: "$special[model.name]"
HealthCheckResult:
@ -1941,15 +1888,231 @@ components:
type: object
type: object
type: object
OuterObjectWithEnumProperty:
example:
value: 2
fruit:
additionalProperties: false
oneOf:
- $ref: '#/components/schemas/apple'
- $ref: '#/components/schemas/banana'
properties:
value:
$ref: '#/components/schemas/OuterEnumInteger'
required:
- value
color:
type: string
apple:
nullable: true
properties:
cultivar:
pattern: "^[a-zA-Z\\s]*$"
type: string
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
type: object
banana:
properties:
lengthCm:
type: number
type: object
mammal:
discriminator:
propertyName: className
oneOf:
- $ref: '#/components/schemas/whale'
- $ref: '#/components/schemas/zebra'
- $ref: '#/components/schemas/Pig'
whale:
properties:
hasBaleen:
type: boolean
hasTeeth:
type: boolean
className:
type: string
required:
- className
type: object
zebra:
additionalProperties: true
properties:
type:
enum:
- plains
- mountain
- grevys
type: string
className:
type: string
required:
- className
type: object
Pig:
discriminator:
propertyName: className
oneOf:
- $ref: '#/components/schemas/BasquePig'
- $ref: '#/components/schemas/DanishPig'
BasquePig:
properties:
className:
type: string
required:
- className
type: object
DanishPig:
properties:
className:
type: string
required:
- className
type: object
gmFruit:
additionalProperties: false
anyOf:
- $ref: '#/components/schemas/apple'
- $ref: '#/components/schemas/banana'
properties:
color:
type: string
fruitReq:
additionalProperties: false
oneOf:
- $ref: '#/components/schemas/appleReq'
- $ref: '#/components/schemas/bananaReq'
appleReq:
additionalProperties: false
properties:
cultivar:
type: string
mealy:
type: boolean
required:
- cultivar
type: object
bananaReq:
additionalProperties: false
properties:
lengthCm:
type: number
sweet:
type: boolean
required:
- lengthCm
type: object
Drawing:
additionalProperties:
$ref: '#/components/schemas/fruit'
properties:
mainShape:
$ref: '#/components/schemas/Shape'
shapeOrNull:
$ref: '#/components/schemas/ShapeOrNull'
nullableShape:
$ref: '#/components/schemas/NullableShape'
shapes:
items:
$ref: '#/components/schemas/Shape'
type: array
type: object
Shape:
discriminator:
propertyName: shapeType
oneOf:
- $ref: '#/components/schemas/Triangle'
- $ref: '#/components/schemas/Quadrilateral'
ShapeOrNull:
description: The value may be a shape or the 'null' value. This is introduced
in OAS schema >= 3.1.
discriminator:
propertyName: shapeType
oneOf:
- $ref: '#/components/schemas/Triangle'
- $ref: '#/components/schemas/Quadrilateral'
NullableShape:
description: The value may be a shape or the 'null' value. The 'nullable' attribute
was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema
>= 3.1.
discriminator:
propertyName: shapeType
nullable: true
oneOf:
- $ref: '#/components/schemas/Triangle'
- $ref: '#/components/schemas/Quadrilateral'
ShapeInterface:
properties:
shapeType:
type: string
required:
- shapeType
TriangleInterface:
properties:
triangleType:
type: string
required:
- triangleType
Triangle:
discriminator:
propertyName: triangleType
oneOf:
- $ref: '#/components/schemas/EquilateralTriangle'
- $ref: '#/components/schemas/IsoscelesTriangle'
- $ref: '#/components/schemas/ScaleneTriangle'
EquilateralTriangle:
allOf:
- $ref: '#/components/schemas/ShapeInterface'
- $ref: '#/components/schemas/TriangleInterface'
IsoscelesTriangle:
additionalProperties: false
allOf:
- $ref: '#/components/schemas/ShapeInterface'
- $ref: '#/components/schemas/TriangleInterface'
ScaleneTriangle:
allOf:
- $ref: '#/components/schemas/ShapeInterface'
- $ref: '#/components/schemas/TriangleInterface'
QuadrilateralInterface:
properties:
quadrilateralType:
type: string
required:
- quadrilateralType
Quadrilateral:
discriminator:
propertyName: quadrilateralType
oneOf:
- $ref: '#/components/schemas/SimpleQuadrilateral'
- $ref: '#/components/schemas/ComplexQuadrilateral'
SimpleQuadrilateral:
allOf:
- $ref: '#/components/schemas/ShapeInterface'
- $ref: '#/components/schemas/QuadrilateralInterface'
ComplexQuadrilateral:
allOf:
- $ref: '#/components/schemas/ShapeInterface'
- $ref: '#/components/schemas/QuadrilateralInterface'
GrandparentAnimal:
discriminator:
propertyName: pet_type
properties:
pet_type:
type: string
required:
- pet_type
type: object
ParentPet:
allOf:
- $ref: '#/components/schemas/GrandparentAnimal'
type: object
ChildCat:
allOf:
- $ref: '#/components/schemas/ParentPet'
- $ref: '#/components/schemas/ChildCat_allOf'
ArrayOfEnums:
items:
$ref: '#/components/schemas/OuterEnum'
type: array
DateTimeTest:
default: 2010-01-01T10:10:10.000111+01:00
example: 2010-01-01T10:10:10.000111+01:00
format: date-time
type: string
DeprecatedObject:
deprecated: true
properties:
@ -1971,20 +2134,6 @@ components:
$ref: '#/components/schemas/Bar'
type: array
type: object
AllOfWithSingleRef:
properties:
username:
type: string
SingleRefType:
allOf:
- $ref: '#/components/schemas/SingleRefType'
type: object
SingleRefType:
enum:
- admin
- user
title: SingleRefType
type: string
_foo_get_default_response:
example:
string:
@ -2086,7 +2235,9 @@ components:
format: date
type: string
dateTime:
default: 2010-02-01T10:20:10.11111+01:00
description: None
example: 2020-02-02T20:20:20.22222Z
format: date-time
type: string
password:
@ -2140,6 +2291,18 @@ components:
type: boolean
type: object
example: null
ChildCat_allOf:
properties:
name:
type: string
pet_type:
default: ChildCat
enum:
- ChildCat
type: string
x-enum-as-string: true
type: object
example: null
securitySchemes:
petstore_auth:
flows:

View File

@ -9,6 +9,12 @@
|------------ | ------------- | ------------- | -------------|
|**mapProperty** | **Map&lt;String, String&gt;** | | [optional] |
|**mapOfMapProperty** | **Map&lt;String, Map&lt;String, String&gt;&gt;** | | [optional] |
|**anytype1** | **Object** | | [optional] |
|**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] |
|**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] |
|**mapWithUndeclaredPropertiesAnytype3** | **Map&lt;String, Object&gt;** | | [optional] |
|**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it&#39;s an empty map. | [optional] |
|**mapWithUndeclaredPropertiesString** | **Map&lt;String, String&gt;** | | [optional] |

View File

@ -0,0 +1,14 @@
# Apple
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**cultivar** | **String** | | [optional] |
|**origin** | **String** | | [optional] |

View File

@ -0,0 +1,14 @@
# AppleReq
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**cultivar** | **String** | | |
|**mealy** | **Boolean** | | [optional] |

View File

@ -0,0 +1,13 @@
# Banana
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**lengthCm** | **BigDecimal** | | [optional] |

View File

@ -0,0 +1,14 @@
# BananaReq
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**lengthCm** | **BigDecimal** | | |
|**sweet** | **Boolean** | | [optional] |

View File

@ -0,0 +1,13 @@
# BasquePig
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**className** | **String** | | |

View File

@ -0,0 +1,22 @@
# ChildCat
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**name** | **String** | | [optional] |
|**petType** | [**String**](#String) | | [optional] |
## Enum: String
| Name | Value |
|---- | -----|
| CHILDCAT | &quot;ChildCat&quot; |

View File

@ -0,0 +1,22 @@
# ChildCatAllOf
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**name** | **String** | | [optional] |
|**petType** | [**String**](#String) | | [optional] |
## Enum: String
| Name | Value |
|---- | -----|
| CHILDCAT | &quot;ChildCat&quot; |

View File

@ -0,0 +1,14 @@
# ComplexQuadrilateral
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**shapeType** | **String** | | |
|**quadrilateralType** | **String** | | |

View File

@ -0,0 +1,13 @@
# DanishPig
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**className** | **String** | | |

View File

@ -0,0 +1,16 @@
# Drawing
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**mainShape** | [**Shape**](Shape.md) | | [optional] |
|**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] |
|**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] |
|**shapes** | [**List&lt;Shape&gt;**](Shape.md) | | [optional] |

View File

@ -10,6 +10,7 @@
|**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] |
|**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | |
|**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] |
|**enumIntegerOnly** | [**EnumIntegerOnlyEnum**](#EnumIntegerOnlyEnum) | | [optional] |
|**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] |
|**outerEnum** | **OuterEnum** | | [optional] |
|**outerEnumInteger** | **OuterEnumInteger** | | [optional] |
@ -47,6 +48,15 @@
## Enum: EnumIntegerOnlyEnum
| Name | Value |
|---- | -----|
| NUMBER_2 | 2 |
| NUMBER_MINUS_2 | -2 |
## Enum: EnumNumberEnum
| Name | Value |

View File

@ -0,0 +1,14 @@
# EquilateralTriangle
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**shapeType** | **String** | | |
|**triangleType** | **String** | | |

View File

@ -6,8 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|------------- | ------------- | -------------|
| [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint |
| [**fakeHealthGetWithHttpInfo**](FakeApi.md#fakeHealthGetWithHttpInfo) | **GET** /fake/health | Health check endpoint |
| [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication |
| [**fakeHttpSignatureTestWithHttpInfo**](FakeApi.md#fakeHttpSignatureTestWithHttpInfo) | **GET** /fake/http-signature-test | test http signature authentication |
| [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | |
| [**fakeOuterBooleanSerializeWithHttpInfo**](FakeApi.md#fakeOuterBooleanSerializeWithHttpInfo) | **POST** /fake/outer/boolean | |
| [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | |
@ -16,10 +14,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**fakeOuterNumberSerializeWithHttpInfo**](FakeApi.md#fakeOuterNumberSerializeWithHttpInfo) | **POST** /fake/outer/number | |
| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | |
| [**fakeOuterStringSerializeWithHttpInfo**](FakeApi.md#fakeOuterStringSerializeWithHttpInfo) | **POST** /fake/outer/string | |
| [**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | |
| [**fakePropertyEnumIntegerSerializeWithHttpInfo**](FakeApi.md#fakePropertyEnumIntegerSerializeWithHttpInfo) | **POST** /fake/property/enum-int | |
| [**testBodyWithBinary**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | |
| [**testBodyWithBinaryWithHttpInfo**](FakeApi.md#testBodyWithBinaryWithHttpInfo) | **PUT** /fake/body-with-binary | |
| [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums |
| [**getArrayOfEnumsWithHttpInfo**](FakeApi.md#getArrayOfEnumsWithHttpInfo) | **GET** /fake/array-of-enums | Array of Enums |
| [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | |
| [**testBodyWithFileSchemaWithHttpInfo**](FakeApi.md#testBodyWithFileSchemaWithHttpInfo) | **PUT** /fake/body-with-file-schema | |
| [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | |
@ -172,155 +168,6 @@ No authorization required
| **200** | The instance started successfully | - |
## fakeHttpSignatureTest
> CompletableFuture<Void> fakeHttpSignatureTest(pet, query1, header1)
test http signature authentication
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
import java.util.concurrent.CompletableFuture;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
String query1 = "query1_example"; // String | query parameter
String header1 = "header1_example"; // String | header parameter
try {
CompletableFuture<Void> result = apiInstance.fakeHttpSignatureTest(pet, query1, header1);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeHttpSignatureTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | |
| **query1** | **String**| query parameter | [optional] |
| **header1** | **String**| header parameter | [optional] |
### Return type
CompletableFuture<void> (empty response body)
### Authorization
[http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | The instance started successfully | - |
## fakeHttpSignatureTestWithHttpInfo
> CompletableFuture<ApiResponse<Void>> fakeHttpSignatureTest fakeHttpSignatureTestWithHttpInfo(pet, query1, header1)
test http signature authentication
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
import java.util.concurrent.CompletableFuture;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
String query1 = "query1_example"; // String | query parameter
String header1 = "header1_example"; // String | header parameter
try {
CompletableFuture<ApiResponse<Void>> response = apiInstance.fakeHttpSignatureTestWithHttpInfo(pet, query1, header1);
System.out.println("Status code: " + response.get().getStatusCode());
System.out.println("Response headers: " + response.get().getHeaders());
} catch (InterruptedException | ExecutionException e) {
ApiException apiException = (ApiException)e.getCause();
System.err.println("Exception when calling FakeApi#fakeHttpSignatureTest");
System.err.println("Status code: " + apiException.getCode());
System.err.println("Response headers: " + apiException.getResponseHeaders());
System.err.println("Reason: " + apiException.getResponseBody());
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeHttpSignatureTest");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
System.err.println("Reason: " + e.getResponseBody());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | |
| **query1** | **String**| query parameter | [optional] |
| **header1** | **String**| header parameter | [optional] |
### Return type
CompletableFuture<ApiResponse<Void>>
### Authorization
[http_signature_test](../README.md#http_signature_test)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | The instance started successfully | - |
## fakeOuterBooleanSerialize
> CompletableFuture<Boolean> fakeOuterBooleanSerialize(body)
@ -893,13 +740,11 @@ No authorization required
| **200** | Output string | - |
## fakePropertyEnumIntegerSerialize
## getArrayOfEnums
> CompletableFuture<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty)
> CompletableFuture<List<OuterEnum>> getArrayOfEnums()
Test serialization of enum (int) properties with examples
Array of Enums
### Example
@ -918,12 +763,11 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
OuterObjectWithEnumProperty outerObjectWithEnumProperty = new OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
try {
CompletableFuture<OuterObjectWithEnumProperty> result = apiInstance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
CompletableFuture<List<OuterEnum>> result = apiInstance.getArrayOfEnums();
System.out.println(result.get());
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakePropertyEnumIntegerSerialize");
System.err.println("Exception when calling FakeApi#getArrayOfEnums");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
@ -935,14 +779,11 @@ public class Example {
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | |
This endpoint does not need any parameter.
### Return type
CompletableFuture<[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)>
CompletableFuture<[**List&lt;OuterEnum&gt;**](OuterEnum.md)>
### Authorization
@ -951,21 +792,19 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: */*
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Output enum (int) | - |
| **200** | Got named array of enums | - |
## fakePropertyEnumIntegerSerializeWithHttpInfo
## getArrayOfEnumsWithHttpInfo
> CompletableFuture<ApiResponse<OuterObjectWithEnumProperty>> fakePropertyEnumIntegerSerialize fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty)
> CompletableFuture<ApiResponse<List<OuterEnum>>> getArrayOfEnums getArrayOfEnumsWithHttpInfo()
Test serialization of enum (int) properties with examples
Array of Enums
### Example
@ -985,21 +824,20 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
OuterObjectWithEnumProperty outerObjectWithEnumProperty = new OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
try {
CompletableFuture<ApiResponse<OuterObjectWithEnumProperty>> response = apiInstance.fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty);
CompletableFuture<ApiResponse<List<OuterEnum>>> response = apiInstance.getArrayOfEnumsWithHttpInfo();
System.out.println("Status code: " + response.get().getStatusCode());
System.out.println("Response headers: " + response.get().getHeaders());
System.out.println("Response body: " + response.get().getData());
} catch (InterruptedException | ExecutionException e) {
ApiException apiException = (ApiException)e.getCause();
System.err.println("Exception when calling FakeApi#fakePropertyEnumIntegerSerialize");
System.err.println("Exception when calling FakeApi#getArrayOfEnums");
System.err.println("Status code: " + apiException.getCode());
System.err.println("Response headers: " + apiException.getResponseHeaders());
System.err.println("Reason: " + apiException.getResponseBody());
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakePropertyEnumIntegerSerialize");
System.err.println("Exception when calling FakeApi#getArrayOfEnums");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
System.err.println("Reason: " + e.getResponseBody());
@ -1011,14 +849,11 @@ public class Example {
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | |
This endpoint does not need any parameter.
### Return type
CompletableFuture<ApiResponse<[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)>>
CompletableFuture<ApiResponse<[**List&lt;OuterEnum&gt;**](OuterEnum.md)>>
### Authorization
@ -1027,154 +862,13 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: */*
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Output enum (int) | - |
## testBodyWithBinary
> CompletableFuture<Void> testBodyWithBinary(body)
For this test, the body has to be a binary file.
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
import java.util.concurrent.CompletableFuture;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
File body = new File("/path/to/file"); // File | image to upload
try {
CompletableFuture<Void> result = apiInstance.testBodyWithBinary(body);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithBinary");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | **File**| image to upload | |
### Return type
CompletableFuture<void> (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success | - |
## testBodyWithBinaryWithHttpInfo
> CompletableFuture<ApiResponse<Void>> testBodyWithBinary testBodyWithBinaryWithHttpInfo(body)
For this test, the body has to be a binary file.
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.FakeApi;
import java.util.concurrent.CompletableFuture;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
FakeApi apiInstance = new FakeApi(defaultClient);
File body = new File("/path/to/file"); // File | image to upload
try {
CompletableFuture<ApiResponse<Void>> response = apiInstance.testBodyWithBinaryWithHttpInfo(body);
System.out.println("Status code: " + response.get().getStatusCode());
System.out.println("Response headers: " + response.get().getHeaders());
} catch (InterruptedException | ExecutionException e) {
ApiException apiException = (ApiException)e.getCause();
System.err.println("Exception when calling FakeApi#testBodyWithBinary");
System.err.println("Status code: " + apiException.getCode());
System.err.println("Response headers: " + apiException.getResponseHeaders());
System.err.println("Reason: " + apiException.getResponseBody());
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithBinary");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
System.err.println("Reason: " + e.getResponseBody());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | **File**| image to upload | |
### Return type
CompletableFuture<ApiResponse<Void>>
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: image/png
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Success | - |
| **200** | Got named array of enums | - |
## testBodyWithFileSchema
@ -1183,7 +877,7 @@ No authorization required
For this test, the body for this request must reference a schema named &#x60;File&#x60;.
For this test, the body for this request much reference a schema named &#x60;File&#x60;.
### Example
@ -1248,7 +942,7 @@ No authorization required
For this test, the body for this request must reference a schema named &#x60;File&#x60;.
For this test, the body for this request much reference a schema named &#x60;File&#x60;.
### Example
@ -1644,7 +1338,7 @@ public class Example {
String string = "string_example"; // String | None
File binary = new File("/path/to/file"); // File | None
LocalDate date = LocalDate.now(); // LocalDate | None
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T10:20:10.111110+01:00"); // OffsetDateTime | None
String password = "password_example"; // String | None
String paramCallback = "paramCallback_example"; // String | None
try {
@ -1676,7 +1370,7 @@ public class Example {
| **string** | **String**| None | [optional] |
| **binary** | **File**| None | [optional] |
| **date** | **LocalDate**| None | [optional] |
| **dateTime** | **OffsetDateTime**| None | [optional] |
| **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T10:20:10.111110+01:00] |
| **password** | **String**| None | [optional] |
| **paramCallback** | **String**| None | [optional] |
@ -1743,7 +1437,7 @@ public class Example {
String string = "string_example"; // String | None
File binary = new File("/path/to/file"); // File | None
LocalDate date = LocalDate.now(); // LocalDate | None
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T10:20:10.111110+01:00"); // OffsetDateTime | None
String password = "password_example"; // String | None
String paramCallback = "paramCallback_example"; // String | None
try {
@ -1784,7 +1478,7 @@ public class Example {
| **string** | **String**| None | [optional] |
| **binary** | **File**| None | [optional] |
| **date** | **LocalDate**| None | [optional] |
| **dateTime** | **OffsetDateTime**| None | [optional] |
| **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T10:20:10.111110+01:00] |
| **password** | **String**| None | [optional] |
| **paramCallback** | **String**| None | [optional] |
@ -1811,7 +1505,7 @@ CompletableFuture<ApiResponse<Void>>
## testEnumParameters
> CompletableFuture<Void> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString)
> CompletableFuture<Void> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)
To test enum parameters
@ -1840,11 +1534,10 @@ public class Example {
String enumQueryString = "_abc"; // String | Query parameter enum test (string)
Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double)
Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double)
List<EnumClass> enumQueryModelArray = Arrays.asList(-efg); // List<EnumClass> |
List<String> enumFormStringArray = Arrays.asList("$"); // List<String> | Form parameter enum test (string array)
String enumFormString = "_abc"; // String | Form parameter enum test (string)
try {
CompletableFuture<Void> result = apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
CompletableFuture<Void> result = apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEnumParameters");
System.err.println("Status code: " + e.getCode());
@ -1867,7 +1560,6 @@ public class Example {
| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] |
| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] |
| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] |
| **enumQueryModelArray** | [**List&lt;EnumClass&gt;**](EnumClass.md)| | [optional] |
| **enumFormStringArray** | [**List&lt;String&gt;**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] |
| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] |
@ -1893,7 +1585,7 @@ No authorization required
## testEnumParametersWithHttpInfo
> CompletableFuture<ApiResponse<Void>> testEnumParameters testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString)
> CompletableFuture<ApiResponse<Void>> testEnumParameters testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)
To test enum parameters
@ -1923,11 +1615,10 @@ public class Example {
String enumQueryString = "_abc"; // String | Query parameter enum test (string)
Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double)
Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double)
List<EnumClass> enumQueryModelArray = Arrays.asList(-efg); // List<EnumClass> |
List<String> enumFormStringArray = Arrays.asList("$"); // List<String> | Form parameter enum test (string array)
String enumFormString = "_abc"; // String | Form parameter enum test (string)
try {
CompletableFuture<ApiResponse<Void>> response = apiInstance.testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
CompletableFuture<ApiResponse<Void>> response = apiInstance.testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
System.out.println("Status code: " + response.get().getStatusCode());
System.out.println("Response headers: " + response.get().getHeaders());
} catch (InterruptedException | ExecutionException e) {
@ -1959,7 +1650,6 @@ public class Example {
| **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] |
| **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] |
| **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] |
| **enumQueryModelArray** | [**List&lt;EnumClass&gt;**](EnumClass.md)| | [optional] |
| **enumFormStringArray** | [**List&lt;String&gt;**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] |
| **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] |
@ -2464,7 +2154,7 @@ No authorization required
## testQueryParameterCollectionFormat
> CompletableFuture<Void> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language)
> CompletableFuture<Void> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context)
@ -2492,10 +2182,8 @@ public class Example {
List<String> http = Arrays.asList(); // List<String> |
List<String> url = Arrays.asList(); // List<String> |
List<String> context = Arrays.asList(); // List<String> |
String allowEmpty = "allowEmpty_example"; // String |
Map<String, String> language = new HashMap(); // Map<String, String> |
try {
CompletableFuture<Void> result = apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language);
CompletableFuture<Void> result = apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat");
System.err.println("Status code: " + e.getCode());
@ -2517,8 +2205,6 @@ public class Example {
| **http** | [**List&lt;String&gt;**](String.md)| | |
| **url** | [**List&lt;String&gt;**](String.md)| | |
| **context** | [**List&lt;String&gt;**](String.md)| | |
| **allowEmpty** | **String**| | |
| **language** | [**Map&lt;String, String&gt;**](String.md)| | [optional] |
### Return type
@ -2541,7 +2227,7 @@ No authorization required
## testQueryParameterCollectionFormatWithHttpInfo
> CompletableFuture<ApiResponse<Void>> testQueryParameterCollectionFormat testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language)
> CompletableFuture<ApiResponse<Void>> testQueryParameterCollectionFormat testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context)
@ -2570,10 +2256,8 @@ public class Example {
List<String> http = Arrays.asList(); // List<String> |
List<String> url = Arrays.asList(); // List<String> |
List<String> context = Arrays.asList(); // List<String> |
String allowEmpty = "allowEmpty_example"; // String |
Map<String, String> language = new HashMap(); // Map<String, String> |
try {
CompletableFuture<ApiResponse<Void>> response = apiInstance.testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language);
CompletableFuture<ApiResponse<Void>> response = apiInstance.testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context);
System.out.println("Status code: " + response.get().getStatusCode());
System.out.println("Response headers: " + response.get().getHeaders());
} catch (InterruptedException | ExecutionException e) {
@ -2604,8 +2288,6 @@ public class Example {
| **http** | [**List&lt;String&gt;**](String.md)| | |
| **url** | [**List&lt;String&gt;**](String.md)| | |
| **context** | [**List&lt;String&gt;**](String.md)| | |
| **allowEmpty** | **String**| | |
| **language** | [**Map&lt;String, String&gt;**](String.md)| | [optional] |
### Return type

View File

@ -0,0 +1,37 @@
# Fruit
## oneOf schemas
* [Apple](Apple.md)
* [Banana](Banana.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.Fruit;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
public class Example {
public static void main(String[] args) {
Fruit exampleFruit = new Fruit();
// create a new Apple
Apple exampleApple = new Apple();
// set Fruit to Apple
exampleFruit.setActualInstance(exampleApple);
// to get back the Apple set earlier
Apple testApple = (Apple) exampleFruit.getActualInstance();
// create a new Banana
Banana exampleBanana = new Banana();
// set Fruit to Banana
exampleFruit.setActualInstance(exampleBanana);
// to get back the Banana set earlier
Banana testBanana = (Banana) exampleFruit.getActualInstance();
}
}
```

View File

@ -0,0 +1,37 @@
# FruitReq
## oneOf schemas
* [AppleReq](AppleReq.md)
* [BananaReq](BananaReq.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.FruitReq;
import org.openapitools.client.model.AppleReq;
import org.openapitools.client.model.BananaReq;
public class Example {
public static void main(String[] args) {
FruitReq exampleFruitReq = new FruitReq();
// create a new AppleReq
AppleReq exampleAppleReq = new AppleReq();
// set FruitReq to AppleReq
exampleFruitReq.setActualInstance(exampleAppleReq);
// to get back the AppleReq set earlier
AppleReq testAppleReq = (AppleReq) exampleFruitReq.getActualInstance();
// create a new BananaReq
BananaReq exampleBananaReq = new BananaReq();
// set FruitReq to BananaReq
exampleFruitReq.setActualInstance(exampleBananaReq);
// to get back the BananaReq set earlier
BananaReq testBananaReq = (BananaReq) exampleFruitReq.getActualInstance();
}
}
```

View File

@ -0,0 +1,37 @@
# GmFruit
## anyOf schemas
* [Apple](Apple.md)
* [Banana](Banana.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.GmFruit;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
public class Example {
public static void main(String[] args) {
GmFruit exampleGmFruit = new GmFruit();
// create a new Apple
Apple exampleApple = new Apple();
// set GmFruit to Apple
exampleGmFruit.setActualInstance(exampleApple);
// to get back the Apple set earlier
Apple testApple = (Apple) exampleGmFruit.getActualInstance();
// create a new Banana
Banana exampleBanana = new Banana();
// set GmFruit to Banana
exampleGmFruit.setActualInstance(exampleBanana);
// to get back the Banana set earlier
Banana testBanana = (Banana) exampleGmFruit.getActualInstance();
}
}
```

View File

@ -0,0 +1,13 @@
# GrandparentAnimal
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**petType** | **String** | | |

View File

@ -0,0 +1,14 @@
# IsoscelesTriangle
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**shapeType** | **String** | | |
|**triangleType** | **String** | | |

View File

@ -0,0 +1,46 @@
# Mammal
## oneOf schemas
* [Pig](Pig.md)
* [Whale](Whale.md)
* [Zebra](Zebra.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.Mammal;
import org.openapitools.client.model.Pig;
import org.openapitools.client.model.Whale;
import org.openapitools.client.model.Zebra;
public class Example {
public static void main(String[] args) {
Mammal exampleMammal = new Mammal();
// create a new Pig
Pig examplePig = new Pig();
// set Mammal to Pig
exampleMammal.setActualInstance(examplePig);
// to get back the Pig set earlier
Pig testPig = (Pig) exampleMammal.getActualInstance();
// create a new Whale
Whale exampleWhale = new Whale();
// set Mammal to Whale
exampleMammal.setActualInstance(exampleWhale);
// to get back the Whale set earlier
Whale testWhale = (Whale) exampleMammal.getActualInstance();
// create a new Zebra
Zebra exampleZebra = new Zebra();
// set Mammal to Zebra
exampleMammal.setActualInstance(exampleZebra);
// to get back the Zebra set earlier
Zebra testZebra = (Zebra) exampleMammal.getActualInstance();
}
}
```

View File

@ -0,0 +1,41 @@
# NullableShape
The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1.
## oneOf schemas
* [Quadrilateral](Quadrilateral.md)
* [Triangle](Triangle.md)
NOTE: this class is nullable.
## Example
```java
// Import classes:
import org.openapitools.client.model.NullableShape;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
public class Example {
public static void main(String[] args) {
NullableShape exampleNullableShape = new NullableShape();
// create a new Quadrilateral
Quadrilateral exampleQuadrilateral = new Quadrilateral();
// set NullableShape to Quadrilateral
exampleNullableShape.setActualInstance(exampleQuadrilateral);
// to get back the Quadrilateral set earlier
Quadrilateral testQuadrilateral = (Quadrilateral) exampleNullableShape.getActualInstance();
// create a new Triangle
Triangle exampleTriangle = new Triangle();
// set NullableShape to Triangle
exampleNullableShape.setActualInstance(exampleTriangle);
// to get back the Triangle set earlier
Triangle testTriangle = (Triangle) exampleNullableShape.getActualInstance();
}
}
```

View File

@ -0,0 +1,12 @@
# ParentPet
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|

View File

@ -10,7 +10,7 @@
|**id** | **Long** | | [optional] |
|**category** | [**Category**](Category.md) | | [optional] |
|**name** | **String** | | |
|**photoUrls** | **Set&lt;String&gt;** | | |
|**photoUrls** | **List&lt;String&gt;** | | |
|**tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] |
|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] |

View File

@ -50,6 +50,7 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
@ -83,7 +84,7 @@ CompletableFuture<void> (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -93,7 +94,6 @@ CompletableFuture<void> (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **405** | Invalid input | - |
## addPetWithHttpInfo
@ -122,6 +122,7 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
@ -164,7 +165,7 @@ CompletableFuture<ApiResponse<Void>>
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -174,7 +175,6 @@ CompletableFuture<ApiResponse<Void>>
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **405** | Invalid input | - |
@ -248,7 +248,6 @@ CompletableFuture<void> (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **400** | Invalid pet value | - |
## deletePetWithHttpInfo
@ -331,7 +330,6 @@ CompletableFuture<ApiResponse<Void>>
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **400** | Invalid pet value | - |
@ -360,6 +358,7 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
@ -394,7 +393,7 @@ CompletableFuture<[**List&lt;Pet&gt;**](Pet.md)>
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -433,6 +432,7 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
@ -476,7 +476,7 @@ CompletableFuture<ApiResponse<[**List&lt;Pet&gt;**](Pet.md)>>
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -492,7 +492,7 @@ CompletableFuture<ApiResponse<[**List&lt;Pet&gt;**](Pet.md)>>
## findPetsByTags
> CompletableFuture<Set<Pet>> findPetsByTags(tags)
> CompletableFuture<List<Pet>> findPetsByTags(tags)
Finds Pets by tags
@ -515,14 +515,15 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(defaultClient);
Set<String> tags = Arrays.asList(); // Set<String> | Tags to filter by
List<String> tags = Arrays.asList(); // List<String> | Tags to filter by
try {
CompletableFuture<Set<Pet>> result = apiInstance.findPetsByTags(tags);
CompletableFuture<List<Pet>> result = apiInstance.findPetsByTags(tags);
System.out.println(result.get());
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#findPetsByTags");
@ -540,16 +541,16 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **tags** | [**Set&lt;String&gt;**](String.md)| Tags to filter by | |
| **tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | |
### Return type
CompletableFuture<[**Set&lt;Pet&gt;**](Pet.md)>
CompletableFuture<[**List&lt;Pet&gt;**](Pet.md)>
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -564,7 +565,7 @@ CompletableFuture<[**Set&lt;Pet&gt;**](Pet.md)>
## findPetsByTagsWithHttpInfo
> CompletableFuture<ApiResponse<Set<Pet>>> findPetsByTags findPetsByTagsWithHttpInfo(tags)
> CompletableFuture<ApiResponse<List<Pet>>> findPetsByTags findPetsByTagsWithHttpInfo(tags)
Finds Pets by tags
@ -588,14 +589,15 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi(defaultClient);
Set<String> tags = Arrays.asList(); // Set<String> | Tags to filter by
List<String> tags = Arrays.asList(); // List<String> | Tags to filter by
try {
CompletableFuture<ApiResponse<Set<Pet>>> response = apiInstance.findPetsByTagsWithHttpInfo(tags);
CompletableFuture<ApiResponse<List<Pet>>> response = apiInstance.findPetsByTagsWithHttpInfo(tags);
System.out.println("Status code: " + response.get().getStatusCode());
System.out.println("Response headers: " + response.get().getHeaders());
System.out.println("Response body: " + response.get().getData());
@ -622,16 +624,16 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **tags** | [**Set&lt;String&gt;**](String.md)| Tags to filter by | |
| **tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | |
### Return type
CompletableFuture<ApiResponse<[**Set&lt;Pet&gt;**](Pet.md)>>
CompletableFuture<ApiResponse<[**List&lt;Pet&gt;**](Pet.md)>>
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -831,6 +833,7 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
@ -864,7 +867,7 @@ CompletableFuture<void> (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -874,7 +877,6 @@ CompletableFuture<void> (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **400** | Invalid ID supplied | - |
| **404** | Pet not found | - |
| **405** | Validation exception | - |
@ -905,6 +907,7 @@ public class Example {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
@ -947,7 +950,7 @@ CompletableFuture<ApiResponse<Void>>
### Authorization
[petstore_auth](../README.md#petstore_auth)
[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers
@ -957,7 +960,6 @@ CompletableFuture<ApiResponse<Void>>
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **400** | Invalid ID supplied | - |
| **404** | Pet not found | - |
| **405** | Validation exception | - |
@ -1035,7 +1037,6 @@ CompletableFuture<void> (empty response body)
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **405** | Invalid input | - |
## updatePetWithFormWithHttpInfo
@ -1120,7 +1121,6 @@ CompletableFuture<ApiResponse<Void>>
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
| **405** | Invalid input | - |

View File

@ -0,0 +1,37 @@
# Pig
## oneOf schemas
* [BasquePig](BasquePig.md)
* [DanishPig](DanishPig.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.Pig;
import org.openapitools.client.model.BasquePig;
import org.openapitools.client.model.DanishPig;
public class Example {
public static void main(String[] args) {
Pig examplePig = new Pig();
// create a new BasquePig
BasquePig exampleBasquePig = new BasquePig();
// set Pig to BasquePig
examplePig.setActualInstance(exampleBasquePig);
// to get back the BasquePig set earlier
BasquePig testBasquePig = (BasquePig) examplePig.getActualInstance();
// create a new DanishPig
DanishPig exampleDanishPig = new DanishPig();
// set Pig to DanishPig
examplePig.setActualInstance(exampleDanishPig);
// to get back the DanishPig set earlier
DanishPig testDanishPig = (DanishPig) examplePig.getActualInstance();
}
}
```

View File

@ -0,0 +1,37 @@
# Quadrilateral
## oneOf schemas
* [ComplexQuadrilateral](ComplexQuadrilateral.md)
* [SimpleQuadrilateral](SimpleQuadrilateral.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.ComplexQuadrilateral;
import org.openapitools.client.model.SimpleQuadrilateral;
public class Example {
public static void main(String[] args) {
Quadrilateral exampleQuadrilateral = new Quadrilateral();
// create a new ComplexQuadrilateral
ComplexQuadrilateral exampleComplexQuadrilateral = new ComplexQuadrilateral();
// set Quadrilateral to ComplexQuadrilateral
exampleQuadrilateral.setActualInstance(exampleComplexQuadrilateral);
// to get back the ComplexQuadrilateral set earlier
ComplexQuadrilateral testComplexQuadrilateral = (ComplexQuadrilateral) exampleQuadrilateral.getActualInstance();
// create a new SimpleQuadrilateral
SimpleQuadrilateral exampleSimpleQuadrilateral = new SimpleQuadrilateral();
// set Quadrilateral to SimpleQuadrilateral
exampleQuadrilateral.setActualInstance(exampleSimpleQuadrilateral);
// to get back the SimpleQuadrilateral set earlier
SimpleQuadrilateral testSimpleQuadrilateral = (SimpleQuadrilateral) exampleQuadrilateral.getActualInstance();
}
}
```

View File

@ -0,0 +1,13 @@
# QuadrilateralInterface
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**quadrilateralType** | **String** | | |

View File

@ -0,0 +1,14 @@
# ScaleneTriangle
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**shapeType** | **String** | | |
|**triangleType** | **String** | | |

View File

@ -0,0 +1,37 @@
# Shape
## oneOf schemas
* [Quadrilateral](Quadrilateral.md)
* [Triangle](Triangle.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.Shape;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
public class Example {
public static void main(String[] args) {
Shape exampleShape = new Shape();
// create a new Quadrilateral
Quadrilateral exampleQuadrilateral = new Quadrilateral();
// set Shape to Quadrilateral
exampleShape.setActualInstance(exampleQuadrilateral);
// to get back the Quadrilateral set earlier
Quadrilateral testQuadrilateral = (Quadrilateral) exampleShape.getActualInstance();
// create a new Triangle
Triangle exampleTriangle = new Triangle();
// set Shape to Triangle
exampleShape.setActualInstance(exampleTriangle);
// to get back the Triangle set earlier
Triangle testTriangle = (Triangle) exampleShape.getActualInstance();
}
}
```

View File

@ -0,0 +1,13 @@
# ShapeInterface
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**shapeType** | **String** | | |

View File

@ -0,0 +1,39 @@
# ShapeOrNull
The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1.
## oneOf schemas
* [Quadrilateral](Quadrilateral.md)
* [Triangle](Triangle.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.ShapeOrNull;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
public class Example {
public static void main(String[] args) {
ShapeOrNull exampleShapeOrNull = new ShapeOrNull();
// create a new Quadrilateral
Quadrilateral exampleQuadrilateral = new Quadrilateral();
// set ShapeOrNull to Quadrilateral
exampleShapeOrNull.setActualInstance(exampleQuadrilateral);
// to get back the Quadrilateral set earlier
Quadrilateral testQuadrilateral = (Quadrilateral) exampleShapeOrNull.getActualInstance();
// create a new Triangle
Triangle exampleTriangle = new Triangle();
// set ShapeOrNull to Triangle
exampleShapeOrNull.setActualInstance(exampleTriangle);
// to get back the Triangle set earlier
Triangle testTriangle = (Triangle) exampleShapeOrNull.getActualInstance();
}
}
```

View File

@ -0,0 +1,14 @@
# SimpleQuadrilateral
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**shapeType** | **String** | | |
|**quadrilateralType** | **String** | | |

View File

@ -8,6 +8,7 @@
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**$specialPropertyName** | **Long** | | [optional] |
|**specialModelName** | **String** | | [optional] |

View File

@ -0,0 +1,46 @@
# Triangle
## oneOf schemas
* [EquilateralTriangle](EquilateralTriangle.md)
* [IsoscelesTriangle](IsoscelesTriangle.md)
* [ScaleneTriangle](ScaleneTriangle.md)
## Example
```java
// Import classes:
import org.openapitools.client.model.Triangle;
import org.openapitools.client.model.EquilateralTriangle;
import org.openapitools.client.model.IsoscelesTriangle;
import org.openapitools.client.model.ScaleneTriangle;
public class Example {
public static void main(String[] args) {
Triangle exampleTriangle = new Triangle();
// create a new EquilateralTriangle
EquilateralTriangle exampleEquilateralTriangle = new EquilateralTriangle();
// set Triangle to EquilateralTriangle
exampleTriangle.setActualInstance(exampleEquilateralTriangle);
// to get back the EquilateralTriangle set earlier
EquilateralTriangle testEquilateralTriangle = (EquilateralTriangle) exampleTriangle.getActualInstance();
// create a new IsoscelesTriangle
IsoscelesTriangle exampleIsoscelesTriangle = new IsoscelesTriangle();
// set Triangle to IsoscelesTriangle
exampleTriangle.setActualInstance(exampleIsoscelesTriangle);
// to get back the IsoscelesTriangle set earlier
IsoscelesTriangle testIsoscelesTriangle = (IsoscelesTriangle) exampleTriangle.getActualInstance();
// create a new ScaleneTriangle
ScaleneTriangle exampleScaleneTriangle = new ScaleneTriangle();
// set Triangle to ScaleneTriangle
exampleTriangle.setActualInstance(exampleScaleneTriangle);
// to get back the ScaleneTriangle set earlier
ScaleneTriangle testScaleneTriangle = (ScaleneTriangle) exampleTriangle.getActualInstance();
}
}
```

View File

@ -0,0 +1,13 @@
# TriangleInterface
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**triangleType** | **String** | | |

View File

@ -15,6 +15,10 @@
|**password** | **String** | | [optional] |
|**phone** | **String** | | [optional] |
|**userStatus** | **Integer** | User Status | [optional] |
|**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the &#39;null&#39; value. | [optional] |
|**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the &#39;null&#39; value. | [optional] |
|**anyTypeProp** | **Object** | test code generation for any type Here the &#39;type&#39; attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] |
|**anyTypePropNullable** | **Object** | test code generation for any type Here the &#39;type&#39; attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The &#39;nullable&#39; attribute does not change the allowed values. | [optional] |

View File

@ -0,0 +1,15 @@
# Whale
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**hasBaleen** | **Boolean** | | [optional] |
|**hasTeeth** | **Boolean** | | [optional] |
|**className** | **String** | | |

View File

@ -0,0 +1,24 @@
# Zebra
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**className** | **String** | | |
## Enum: TypeEnum
| Name | Value |
|---- | -----|
| PLAINS | &quot;plains&quot; |
| MOUNTAIN | &quot;mountain&quot; |
| GREVYS | &quot;grevys&quot; |

View File

@ -19,15 +19,13 @@ import org.openapitools.client.Pair;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import org.openapitools.client.model.EnumClass;
import java.io.File;
import org.openapitools.client.model.FileSchemaTestClass;
import org.openapitools.client.model.HealthCheckResult;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.OuterObjectWithEnumProperty;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.OuterEnum;
import org.openapitools.client.model.User;
import com.fasterxml.jackson.core.type.TypeReference;
@ -172,111 +170,6 @@ public class FakeApi {
}
return localVarRequestBuilder;
}
/**
* test http signature authentication
*
* @param pet Pet object that needs to be added to the store (required)
* @param query1 query parameter (optional)
* @param header1 header parameter (optional)
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> fakeHttpSignatureTest(Pet pet, String query1, String header1) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakeHttpSignatureTestRequestBuilder(pet, query1, header1);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakeHttpSignatureTest", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* test http signature authentication
*
* @param pet Pet object that needs to be added to the store (required)
* @param query1 query parameter (optional)
* @param header1 header parameter (optional)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> fakeHttpSignatureTestWithHttpInfo(Pet pet, String query1, String header1) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakeHttpSignatureTestRequestBuilder(pet, query1, header1);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakeHttpSignatureTest", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse<Void>(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder fakeHttpSignatureTestRequestBuilder(Pet pet, String query1, String header1) throws ApiException {
// verify the required parameter 'pet' is set
if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling fakeHttpSignatureTest");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/fake/http-signature-test";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "query_1";
localVarQueryParams.addAll(ApiClient.parameterToPairs("query_1", query1));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
if (header1 != null) {
localVarRequestBuilder.header("header_1", header1.toString());
}
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet);
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
*
* Test serialization of outer boolean types
@ -649,25 +542,24 @@ public class FakeApi {
return localVarRequestBuilder;
}
/**
* Array of Enums
*
* Test serialization of enum (int) properties with examples
* @param outerObjectWithEnumProperty Input enum (int) as post body (required)
* @return CompletableFuture&lt;OuterObjectWithEnumProperty&gt;
* @return CompletableFuture&lt;List&lt;OuterEnum&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws ApiException {
public CompletableFuture<List<OuterEnum>> getArrayOfEnums() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakePropertyEnumIntegerSerializeRequestBuilder(outerObjectWithEnumProperty);
HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakePropertyEnumIntegerSerialize", localVarResponse));
return CompletableFuture.failedFuture(getApiException("getArrayOfEnums", localVarResponse));
}
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<OuterObjectWithEnumProperty>() {})
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<OuterEnum>>() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@ -680,15 +572,14 @@ public class FakeApi {
}
/**
* Array of Enums
*
* Test serialization of enum (int) properties with examples
* @param outerObjectWithEnumProperty Input enum (int) as post body (required)
* @return CompletableFuture&lt;ApiResponse&lt;OuterObjectWithEnumProperty&gt;&gt;
* @return CompletableFuture&lt;ApiResponse&lt;List&lt;OuterEnum&gt;&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<OuterObjectWithEnumProperty>> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws ApiException {
public CompletableFuture<ApiResponse<List<OuterEnum>>> getArrayOfEnumsWithHttpInfo() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = fakePropertyEnumIntegerSerializeRequestBuilder(outerObjectWithEnumProperty);
HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@ -696,15 +587,15 @@ public class FakeApi {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("fakePropertyEnumIntegerSerialize", localVarResponse));
return CompletableFuture.failedFuture(getApiException("getArrayOfEnums", localVarResponse));
}
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
new ApiResponse<OuterObjectWithEnumProperty>(
new ApiResponse<List<OuterEnum>>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<OuterObjectWithEnumProperty>() {}))
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<OuterEnum>>() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@ -717,110 +608,17 @@ public class FakeApi {
}
}
private HttpRequest.Builder fakePropertyEnumIntegerSerializeRequestBuilder(OuterObjectWithEnumProperty outerObjectWithEnumProperty) throws ApiException {
// verify the required parameter 'outerObjectWithEnumProperty' is set
if (outerObjectWithEnumProperty == null) {
throw new ApiException(400, "Missing the required parameter 'outerObjectWithEnumProperty' when calling fakePropertyEnumIntegerSerialize");
}
private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/fake/property/enum-int";
String localVarPath = "/fake/array-of-enums";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "*/*");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(outerObjectWithEnumProperty);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
*
* For this test, the body has to be a binary file.
* @param body image to upload (required)
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> testBodyWithBinary(File body) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testBodyWithBinaryRequestBuilder(body);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("testBodyWithBinary", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
*
* For this test, the body has to be a binary file.
* @param body image to upload (required)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> testBodyWithBinaryWithHttpInfo(File body) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testBodyWithBinaryRequestBuilder(body);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("testBodyWithBinary", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse<Void>(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder testBodyWithBinaryRequestBuilder(File body) throws ApiException {
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithBinary");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/fake/body-with-binary";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "image/png");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
@ -831,7 +629,7 @@ public class FakeApi {
}
/**
*
* For this test, the body for this request must reference a schema named &#x60;File&#x60;.
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
* @param fileSchemaTestClass (required)
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
@ -855,7 +653,7 @@ public class FakeApi {
/**
*
* For this test, the body for this request must reference a schema named &#x60;File&#x60;.
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
* @param fileSchemaTestClass (required)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
@ -1128,7 +926,7 @@ public class FakeApi {
* @param string None (optional)
* @param binary None (optional)
* @param date None (optional)
* @param dateTime None (optional)
* @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
* @param password None (optional)
* @param paramCallback None (optional)
* @return CompletableFuture&lt;Void&gt;
@ -1165,7 +963,7 @@ public class FakeApi {
* @param string None (optional)
* @param binary None (optional)
* @param date None (optional)
* @param dateTime None (optional)
* @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
* @param password None (optional)
* @param paramCallback None (optional)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
@ -1238,15 +1036,14 @@ public class FakeApi {
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumQueryModelArray (optional
* @param enumFormStringArray Form parameter enum test (string array) (optional
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<EnumClass> enumQueryModelArray, List<String> enumFormStringArray, String enumFormString) throws ApiException {
public CompletableFuture<Void> testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@ -1270,15 +1067,14 @@ public class FakeApi {
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumQueryModelArray (optional
* @param enumFormStringArray Form parameter enum test (string array) (optional
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<EnumClass> enumQueryModelArray, List<String> enumFormStringArray, String enumFormString) throws ApiException {
public CompletableFuture<ApiResponse<Void>> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@ -1299,7 +1095,7 @@ public class FakeApi {
}
}
private HttpRequest.Builder testEnumParametersRequestBuilder(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<EnumClass> enumQueryModelArray, List<String> enumFormStringArray, String enumFormString) throws ApiException {
private HttpRequest.Builder testEnumParametersRequestBuilder(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@ -1316,8 +1112,6 @@ public class FakeApi {
localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_integer", enumQueryInteger));
localVarQueryParameterBaseName = "enum_query_double";
localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_double", enumQueryDouble));
localVarQueryParameterBaseName = "enum_query_model_array";
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "enum_query_model_array", enumQueryModelArray));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
@ -1754,14 +1548,12 @@ public class FakeApi {
* @param http (required)
* @param url (required)
* @param context (required)
* @param allowEmpty (required)
* @param language (optional
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language) throws ApiException {
public CompletableFuture<Void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context, allowEmpty, language);
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@ -1784,14 +1576,12 @@ public class FakeApi {
* @param http (required)
* @param url (required)
* @param context (required)
* @param allowEmpty (required)
* @param language (optional
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language) throws ApiException {
public CompletableFuture<ApiResponse<Void>> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context, allowEmpty, language);
HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@ -1812,7 +1602,7 @@ public class FakeApi {
}
}
private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context, String allowEmpty, Map<String, String> language) throws ApiException {
private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
// verify the required parameter 'pipe' is set
if (pipe == null) {
throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat");
@ -1833,10 +1623,6 @@ public class FakeApi {
if (context == null) {
throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat");
}
// verify the required parameter 'allowEmpty' is set
if (allowEmpty == null) {
throw new ApiException(400, "Missing the required parameter 'allowEmpty' when calling testQueryParameterCollectionFormat");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@ -1846,7 +1632,7 @@ public class FakeApi {
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "pipe";
localVarQueryParams.addAll(ApiClient.parameterToPairs("pipes", "pipe", pipe));
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "pipe", pipe));
localVarQueryParameterBaseName = "ioutil";
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "ioutil", ioutil));
localVarQueryParameterBaseName = "http";
@ -1855,10 +1641,6 @@ public class FakeApi {
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "url", url));
localVarQueryParameterBaseName = "context";
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "context", context));
localVarQueryParameterBaseName = "language";
localVarQueryParams.addAll(ApiClient.parameterToPairs("language", language));
localVarQueryParameterBaseName = "allowEmpty";
localVarQueryParams.addAll(ApiClient.parameterToPairs("allowEmpty", allowEmpty));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");

View File

@ -20,7 +20,6 @@ import org.openapitools.client.Pair;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -355,12 +354,12 @@ public class PetApi {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @return CompletableFuture&lt;Set&lt;Pet&gt;&gt;
* @return CompletableFuture&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture<Set<Pet>> findPetsByTags(Set<String> tags) throws ApiException {
public CompletableFuture<List<Pet>> findPetsByTags(List<String> tags) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags);
return memberVarHttpClient.sendAsync(
@ -372,7 +371,7 @@ public class PetApi {
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Set<Pet>>() {})
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<Pet>>() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@ -388,12 +387,12 @@ public class PetApi {
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @return CompletableFuture&lt;ApiResponse&lt;Set&lt;Pet&gt;&gt;&gt;
* @return CompletableFuture&lt;ApiResponse&lt;List&lt;Pet&gt;&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture<ApiResponse<Set<Pet>>> findPetsByTagsWithHttpInfo(Set<String> tags) throws ApiException {
public CompletableFuture<ApiResponse<List<Pet>>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags);
return memberVarHttpClient.sendAsync(
@ -408,10 +407,10 @@ public class PetApi {
try {
String responseBody = localVarResponse.body();
return CompletableFuture.completedFuture(
new ApiResponse<Set<Pet>>(
new ApiResponse<List<Pet>>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Set<Pet>>() {}))
responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<Pet>>() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
@ -424,7 +423,7 @@ public class PetApi {
}
}
private HttpRequest.Builder findPetsByTagsRequestBuilder(Set<String> tags) throws ApiException {
private HttpRequest.Builder findPetsByTagsRequestBuilder(List<String> tags) throws ApiException {
// verify the required parameter 'tags' is set
if (tags == null) {
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");

View File

@ -27,6 +27,10 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@ -35,7 +39,13 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
*/
@JsonPropertyOrder({
AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY
AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY,
AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3,
AdditionalPropertiesClass.JSON_PROPERTY_EMPTY_MAP,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AdditionalPropertiesClass {
@ -45,6 +55,24 @@ public class AdditionalPropertiesClass {
public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property";
private Map<String, Map<String, String>> mapOfMapProperty = null;
public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1";
private JsonNullable<Object> anytype1 = JsonNullable.<Object>of(null);
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1";
private Object mapWithUndeclaredPropertiesAnytype1;
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2";
private Object mapWithUndeclaredPropertiesAnytype2;
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3";
private Map<String, Object> mapWithUndeclaredPropertiesAnytype3 = null;
public static final String JSON_PROPERTY_EMPTY_MAP = "empty_map";
private Object emptyMap;
public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string";
private Map<String, String> mapWithUndeclaredPropertiesString = null;
public AdditionalPropertiesClass() {
}
@ -114,6 +142,180 @@ public class AdditionalPropertiesClass {
}
public AdditionalPropertiesClass anytype1(Object anytype1) {
this.anytype1 = JsonNullable.<Object>of(anytype1);
return this;
}
/**
* Get anytype1
* @return anytype1
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getAnytype1() {
return anytype1.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ANYTYPE1)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getAnytype1_JsonNullable() {
return anytype1;
}
@JsonProperty(JSON_PROPERTY_ANYTYPE1)
public void setAnytype1_JsonNullable(JsonNullable<Object> anytype1) {
this.anytype1 = anytype1;
}
public void setAnytype1(Object anytype1) {
this.anytype1 = JsonNullable.<Object>of(anytype1);
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) {
this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1;
return this;
}
/**
* Get mapWithUndeclaredPropertiesAnytype1
* @return mapWithUndeclaredPropertiesAnytype1
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getMapWithUndeclaredPropertiesAnytype1() {
return mapWithUndeclaredPropertiesAnytype1;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) {
this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1;
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) {
this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2;
return this;
}
/**
* Get mapWithUndeclaredPropertiesAnytype2
* @return mapWithUndeclaredPropertiesAnytype2
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getMapWithUndeclaredPropertiesAnytype2() {
return mapWithUndeclaredPropertiesAnytype2;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) {
this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2;
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(Map<String, Object> mapWithUndeclaredPropertiesAnytype3) {
this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3;
return this;
}
public AdditionalPropertiesClass putMapWithUndeclaredPropertiesAnytype3Item(String key, Object mapWithUndeclaredPropertiesAnytype3Item) {
if (this.mapWithUndeclaredPropertiesAnytype3 == null) {
this.mapWithUndeclaredPropertiesAnytype3 = new HashMap<>();
}
this.mapWithUndeclaredPropertiesAnytype3.put(key, mapWithUndeclaredPropertiesAnytype3Item);
return this;
}
/**
* Get mapWithUndeclaredPropertiesAnytype3
* @return mapWithUndeclaredPropertiesAnytype3
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public Map<String, Object> getMapWithUndeclaredPropertiesAnytype3() {
return mapWithUndeclaredPropertiesAnytype3;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesAnytype3(Map<String, Object> mapWithUndeclaredPropertiesAnytype3) {
this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3;
}
public AdditionalPropertiesClass emptyMap(Object emptyMap) {
this.emptyMap = emptyMap;
return this;
}
/**
* an object with no declared properties and no undeclared properties, hence it&#39;s an empty map.
* @return emptyMap
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_EMPTY_MAP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getEmptyMap() {
return emptyMap;
}
@JsonProperty(JSON_PROPERTY_EMPTY_MAP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEmptyMap(Object emptyMap) {
this.emptyMap = emptyMap;
}
public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(Map<String, String> mapWithUndeclaredPropertiesString) {
this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString;
return this;
}
public AdditionalPropertiesClass putMapWithUndeclaredPropertiesStringItem(String key, String mapWithUndeclaredPropertiesStringItem) {
if (this.mapWithUndeclaredPropertiesString == null) {
this.mapWithUndeclaredPropertiesString = new HashMap<>();
}
this.mapWithUndeclaredPropertiesString.put(key, mapWithUndeclaredPropertiesStringItem);
return this;
}
/**
* Get mapWithUndeclaredPropertiesString
* @return mapWithUndeclaredPropertiesString
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Map<String, String> getMapWithUndeclaredPropertiesString() {
return mapWithUndeclaredPropertiesString;
}
@JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMapWithUndeclaredPropertiesString(Map<String, String> mapWithUndeclaredPropertiesString) {
this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString;
}
/**
* Return true if this AdditionalPropertiesClass object is equal to o.
*/
@ -127,12 +329,29 @@ public class AdditionalPropertiesClass {
}
AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o;
return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) &&
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty);
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty) &&
equalsNullable(this.anytype1, additionalPropertiesClass.anytype1) &&
Objects.equals(this.mapWithUndeclaredPropertiesAnytype1, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype1) &&
Objects.equals(this.mapWithUndeclaredPropertiesAnytype2, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype2) &&
Objects.equals(this.mapWithUndeclaredPropertiesAnytype3, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype3) &&
Objects.equals(this.emptyMap, additionalPropertiesClass.emptyMap) &&
Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(mapProperty, mapOfMapProperty);
return Objects.hash(mapProperty, mapOfMapProperty, hashCodeNullable(anytype1), mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
@ -141,6 +360,12 @@ public class AdditionalPropertiesClass {
sb.append("class AdditionalPropertiesClass {\n");
sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n");
sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n");
sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n");
sb.append(" mapWithUndeclaredPropertiesAnytype1: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype1)).append("\n");
sb.append(" mapWithUndeclaredPropertiesAnytype2: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype2)).append("\n");
sb.append(" mapWithUndeclaredPropertiesAnytype3: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype3)).append("\n");
sb.append(" emptyMap: ").append(toIndentedString(emptyMap)).append("\n");
sb.append(" mapWithUndeclaredPropertiesString: ").append(toIndentedString(mapWithUndeclaredPropertiesString)).append("\n");
sb.append("}");
return sb.toString();
}
@ -206,6 +431,44 @@ public class AdditionalPropertiesClass {
}
}
// add `anytype_1` to the URL query string
if (getAnytype1() != null) {
joiner.add(String.format("%sanytype_1%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAnytype1()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_anytype_1` to the URL query string
if (getMapWithUndeclaredPropertiesAnytype1() != null) {
joiner.add(String.format("%smap_with_undeclared_properties_anytype_1%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesAnytype1()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_anytype_2` to the URL query string
if (getMapWithUndeclaredPropertiesAnytype2() != null) {
joiner.add(String.format("%smap_with_undeclared_properties_anytype_2%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesAnytype2()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_anytype_3` to the URL query string
if (getMapWithUndeclaredPropertiesAnytype3() != null) {
for (String _key : getMapWithUndeclaredPropertiesAnytype3().keySet()) {
joiner.add(String.format("%smap_with_undeclared_properties_anytype_3%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
getMapWithUndeclaredPropertiesAnytype3().get(_key), URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesAnytype3().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
// add `empty_map` to the URL query string
if (getEmptyMap() != null) {
joiner.add(String.format("%sempty_map%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEmptyMap()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `map_with_undeclared_properties_string` to the URL query string
if (getMapWithUndeclaredPropertiesString() != null) {
for (String _key : getMapWithUndeclaredPropertiesString().keySet()) {
joiner.add(String.format("%smap_with_undeclared_properties_string%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
getMapWithUndeclaredPropertiesString().get(_key), URLEncoder.encode(String.valueOf(getMapWithUndeclaredPropertiesString().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
}
return joiner.toString();
}
}

View File

@ -0,0 +1,186 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Apple
*/
@JsonPropertyOrder({
Apple.JSON_PROPERTY_CULTIVAR,
Apple.JSON_PROPERTY_ORIGIN
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Apple {
public static final String JSON_PROPERTY_CULTIVAR = "cultivar";
private String cultivar;
public static final String JSON_PROPERTY_ORIGIN = "origin";
private String origin;
public Apple() {
}
public Apple cultivar(String cultivar) {
this.cultivar = cultivar;
return this;
}
/**
* Get cultivar
* @return cultivar
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getCultivar() {
return cultivar;
}
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setCultivar(String cultivar) {
this.cultivar = cultivar;
}
public Apple origin(String origin) {
this.origin = origin;
return this;
}
/**
* Get origin
* @return origin
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ORIGIN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getOrigin() {
return origin;
}
@JsonProperty(JSON_PROPERTY_ORIGIN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setOrigin(String origin) {
this.origin = origin;
}
/**
* Return true if this apple object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Apple apple = (Apple) o;
return Objects.equals(this.cultivar, apple.cultivar) &&
Objects.equals(this.origin, apple.origin);
}
@Override
public int hashCode() {
return Objects.hash(cultivar, origin);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Apple {\n");
sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n");
sb.append(" origin: ").append(toIndentedString(origin)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `cultivar` to the URL query string
if (getCultivar() != null) {
joiner.add(String.format("%scultivar%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getCultivar()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `origin` to the URL query string
if (getOrigin() != null) {
joiner.add(String.format("%sorigin%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getOrigin()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,186 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* AppleReq
*/
@JsonPropertyOrder({
AppleReq.JSON_PROPERTY_CULTIVAR,
AppleReq.JSON_PROPERTY_MEALY
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AppleReq {
public static final String JSON_PROPERTY_CULTIVAR = "cultivar";
private String cultivar;
public static final String JSON_PROPERTY_MEALY = "mealy";
private Boolean mealy;
public AppleReq() {
}
public AppleReq cultivar(String cultivar) {
this.cultivar = cultivar;
return this;
}
/**
* Get cultivar
* @return cultivar
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getCultivar() {
return cultivar;
}
@JsonProperty(JSON_PROPERTY_CULTIVAR)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setCultivar(String cultivar) {
this.cultivar = cultivar;
}
public AppleReq mealy(Boolean mealy) {
this.mealy = mealy;
return this;
}
/**
* Get mealy
* @return mealy
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MEALY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getMealy() {
return mealy;
}
@JsonProperty(JSON_PROPERTY_MEALY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMealy(Boolean mealy) {
this.mealy = mealy;
}
/**
* Return true if this appleReq object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AppleReq appleReq = (AppleReq) o;
return Objects.equals(this.cultivar, appleReq.cultivar) &&
Objects.equals(this.mealy, appleReq.mealy);
}
@Override
public int hashCode() {
return Objects.hash(cultivar, mealy);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AppleReq {\n");
sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n");
sb.append(" mealy: ").append(toIndentedString(mealy)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `cultivar` to the URL query string
if (getCultivar() != null) {
joiner.add(String.format("%scultivar%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getCultivar()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `mealy` to the URL query string
if (getMealy() != null) {
joiner.add(String.format("%smealy%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getMealy()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,151 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Banana
*/
@JsonPropertyOrder({
Banana.JSON_PROPERTY_LENGTH_CM
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Banana {
public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm";
private BigDecimal lengthCm;
public Banana() {
}
public Banana lengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
return this;
}
/**
* Get lengthCm
* @return lengthCm
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public BigDecimal getLengthCm() {
return lengthCm;
}
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setLengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
}
/**
* Return true if this banana object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Banana banana = (Banana) o;
return Objects.equals(this.lengthCm, banana.lengthCm);
}
@Override
public int hashCode() {
return Objects.hash(lengthCm);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Banana {\n");
sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `lengthCm` to the URL query string
if (getLengthCm() != null) {
joiner.add(String.format("%slengthCm%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getLengthCm()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,187 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* BananaReq
*/
@JsonPropertyOrder({
BananaReq.JSON_PROPERTY_LENGTH_CM,
BananaReq.JSON_PROPERTY_SWEET
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class BananaReq {
public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm";
private BigDecimal lengthCm;
public static final String JSON_PROPERTY_SWEET = "sweet";
private Boolean sweet;
public BananaReq() {
}
public BananaReq lengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
return this;
}
/**
* Get lengthCm
* @return lengthCm
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public BigDecimal getLengthCm() {
return lengthCm;
}
@JsonProperty(JSON_PROPERTY_LENGTH_CM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setLengthCm(BigDecimal lengthCm) {
this.lengthCm = lengthCm;
}
public BananaReq sweet(Boolean sweet) {
this.sweet = sweet;
return this;
}
/**
* Get sweet
* @return sweet
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SWEET)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getSweet() {
return sweet;
}
@JsonProperty(JSON_PROPERTY_SWEET)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSweet(Boolean sweet) {
this.sweet = sweet;
}
/**
* Return true if this bananaReq object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BananaReq bananaReq = (BananaReq) o;
return Objects.equals(this.lengthCm, bananaReq.lengthCm) &&
Objects.equals(this.sweet, bananaReq.sweet);
}
@Override
public int hashCode() {
return Objects.hash(lengthCm, sweet);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BananaReq {\n");
sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n");
sb.append(" sweet: ").append(toIndentedString(sweet)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `lengthCm` to the URL query string
if (getLengthCm() != null) {
joiner.add(String.format("%slengthCm%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getLengthCm()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `sweet` to the URL query string
if (getSweet() != null) {
joiner.add(String.format("%ssweet%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSweet()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,150 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* BasquePig
*/
@JsonPropertyOrder({
BasquePig.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class BasquePig {
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public BasquePig() {
}
public BasquePig className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* Return true if this BasquePig object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BasquePig basquePig = (BasquePig) o;
return Objects.equals(this.className, basquePig.className);
}
@Override
public int hashCode() {
return Objects.hash(className);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BasquePig {\n");
sb.append(" className: ").append(toIndentedString(className)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,219 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.ParentPet;
import java.util.Set;
import java.util.HashSet;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* ChildCat
*/
@JsonPropertyOrder({
ChildCat.JSON_PROPERTY_NAME,
ChildCat.JSON_PROPERTY_PET_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonIgnoreProperties(
value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the pet_type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true)
public class ChildCat extends ParentPet {
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_PET_TYPE = "pet_type";
private String petType = "ChildCat";
public ChildCat() {
}
public ChildCat name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
public static final Set<String> PET_TYPE_VALUES = new HashSet<>(Arrays.asList(
"ChildCat"
));
public ChildCat petType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
return this;
}
/**
* Get petType
* @return petType
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getPetType() {
return petType;
}
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setPetType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
}
/**
* Return true if this ChildCat object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChildCat childCat = (ChildCat) o;
return Objects.equals(this.name, childCat.name) &&
Objects.equals(this.petType, childCat.petType) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(name, petType, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChildCat {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" petType: ").append(toIndentedString(petType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
static {
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ChildCat", ChildCat.class);
JSON.registerDiscriminator(ChildCat.class, "pet_type", mappings);
}
}

View File

@ -0,0 +1,200 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Set;
import java.util.HashSet;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ChildCatAllOf
*/
@JsonPropertyOrder({
ChildCatAllOf.JSON_PROPERTY_NAME,
ChildCatAllOf.JSON_PROPERTY_PET_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ChildCatAllOf {
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_PET_TYPE = "pet_type";
private String petType = "ChildCat";
public ChildCatAllOf() {
}
public ChildCatAllOf name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
public static final Set<String> PET_TYPE_VALUES = new HashSet<>(Arrays.asList(
"ChildCat"
));
public ChildCatAllOf petType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
return this;
}
/**
* Get petType
* @return petType
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getPetType() {
return petType;
}
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setPetType(String petType) {
if (!PET_TYPE_VALUES.contains(petType)) {
throw new IllegalArgumentException(petType + " is invalid. Possible values for petType: " + String.join(", ", PET_TYPE_VALUES));
}
this.petType = petType;
}
/**
* Return true if this ChildCat_allOf object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ChildCatAllOf childCatAllOf = (ChildCatAllOf) o;
return Objects.equals(this.name, childCatAllOf.name) &&
Objects.equals(this.petType, childCatAllOf.petType);
}
@Override
public int hashCode() {
return Objects.hash(name, petType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ChildCatAllOf {\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" petType: ").append(toIndentedString(petType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,186 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ComplexQuadrilateral
*/
@JsonPropertyOrder({
ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE,
ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ComplexQuadrilateral {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType";
private String quadrilateralType;
public ComplexQuadrilateral() {
}
public ComplexQuadrilateral shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public ComplexQuadrilateral quadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
return this;
}
/**
* Get quadrilateralType
* @return quadrilateralType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getQuadrilateralType() {
return quadrilateralType;
}
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setQuadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
}
/**
* Return true if this ComplexQuadrilateral object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComplexQuadrilateral complexQuadrilateral = (ComplexQuadrilateral) o;
return Objects.equals(this.shapeType, complexQuadrilateral.shapeType) &&
Objects.equals(this.quadrilateralType, complexQuadrilateral.quadrilateralType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, quadrilateralType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ComplexQuadrilateral {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `quadrilateralType` to the URL query string
if (getQuadrilateralType() != null) {
joiner.add(String.format("%squadrilateralType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getQuadrilateralType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,150 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* DanishPig
*/
@JsonPropertyOrder({
DanishPig.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DanishPig {
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public DanishPig() {
}
public DanishPig className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* Return true if this DanishPig object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DanishPig danishPig = (DanishPig) o;
return Objects.equals(this.className, danishPig.className);
}
@Override
public int hashCode() {
return Objects.hash(className);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DanishPig {\n");
sb.append(" className: ").append(toIndentedString(className)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,353 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.client.model.Fruit;
import org.openapitools.client.model.NullableShape;
import org.openapitools.client.model.Shape;
import org.openapitools.client.model.ShapeOrNull;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Drawing
*/
@JsonPropertyOrder({
Drawing.JSON_PROPERTY_MAIN_SHAPE,
Drawing.JSON_PROPERTY_SHAPE_OR_NULL,
Drawing.JSON_PROPERTY_NULLABLE_SHAPE,
Drawing.JSON_PROPERTY_SHAPES
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Drawing extends HashMap<String, Fruit> {
public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape";
private Shape mainShape;
public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull";
private ShapeOrNull shapeOrNull;
public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape";
private JsonNullable<NullableShape> nullableShape = JsonNullable.<NullableShape>undefined();
public static final String JSON_PROPERTY_SHAPES = "shapes";
private List<Shape> shapes = null;
public Drawing() {
}
public Drawing mainShape(Shape mainShape) {
this.mainShape = mainShape;
return this;
}
/**
* Get mainShape
* @return mainShape
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MAIN_SHAPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Shape getMainShape() {
return mainShape;
}
@JsonProperty(JSON_PROPERTY_MAIN_SHAPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMainShape(Shape mainShape) {
this.mainShape = mainShape;
}
public Drawing shapeOrNull(ShapeOrNull shapeOrNull) {
this.shapeOrNull = shapeOrNull;
return this;
}
/**
* Get shapeOrNull
* @return shapeOrNull
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public ShapeOrNull getShapeOrNull() {
return shapeOrNull;
}
@JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setShapeOrNull(ShapeOrNull shapeOrNull) {
this.shapeOrNull = shapeOrNull;
}
public Drawing nullableShape(NullableShape nullableShape) {
this.nullableShape = JsonNullable.<NullableShape>of(nullableShape);
return this;
}
/**
* Get nullableShape
* @return nullableShape
**/
@javax.annotation.Nullable
@JsonIgnore
public NullableShape getNullableShape() {
return nullableShape.orElse(null);
}
@JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<NullableShape> getNullableShape_JsonNullable() {
return nullableShape;
}
@JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE)
public void setNullableShape_JsonNullable(JsonNullable<NullableShape> nullableShape) {
this.nullableShape = nullableShape;
}
public void setNullableShape(NullableShape nullableShape) {
this.nullableShape = JsonNullable.<NullableShape>of(nullableShape);
}
public Drawing shapes(List<Shape> shapes) {
this.shapes = shapes;
return this;
}
public Drawing addShapesItem(Shape shapesItem) {
if (this.shapes == null) {
this.shapes = new ArrayList<>();
}
this.shapes.add(shapesItem);
return this;
}
/**
* Get shapes
* @return shapes
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SHAPES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<Shape> getShapes() {
return shapes;
}
@JsonProperty(JSON_PROPERTY_SHAPES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setShapes(List<Shape> shapes) {
this.shapes = shapes;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Fruit> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public Drawing putAdditionalProperty(String key, Fruit value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Fruit>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, Fruit> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @return the additional (undeclared) property with the specified name
*/
public Fruit getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
/**
* Return true if this Drawing object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Drawing drawing = (Drawing) o;
return Objects.equals(this.mainShape, drawing.mainShape) &&
Objects.equals(this.shapeOrNull, drawing.shapeOrNull) &&
equalsNullable(this.nullableShape, drawing.nullableShape) &&
Objects.equals(this.shapes, drawing.shapes)&&
Objects.equals(this.additionalProperties, drawing.additionalProperties) &&
super.equals(o);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(mainShape, shapeOrNull, hashCodeNullable(nullableShape), shapes, super.hashCode(), additionalProperties);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Drawing {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n");
sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n");
sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n");
sb.append(" shapes: ").append(toIndentedString(shapes)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `mainShape` to the URL query string
if (getMainShape() != null) {
joiner.add(getMainShape().toUrlQueryString(prefix + "mainShape" + suffix));
}
// add `shapeOrNull` to the URL query string
if (getShapeOrNull() != null) {
joiner.add(getShapeOrNull().toUrlQueryString(prefix + "shapeOrNull" + suffix));
}
// add `nullableShape` to the URL query string
if (getNullableShape() != null) {
joiner.add(getNullableShape().toUrlQueryString(prefix + "nullableShape" + suffix));
}
// add `shapes` to the URL query string
if (getShapes() != null) {
for (int i = 0; i < getShapes().size(); i++) {
if (getShapes().get(i) != null) {
joiner.add(getShapes().get(i).toUrlQueryString(String.format("%sshapes%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
return joiner.toString();
}
}

View File

@ -43,6 +43,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
EnumTest.JSON_PROPERTY_ENUM_STRING,
EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED,
EnumTest.JSON_PROPERTY_ENUM_INTEGER,
EnumTest.JSON_PROPERTY_ENUM_INTEGER_ONLY,
EnumTest.JSON_PROPERTY_ENUM_NUMBER,
EnumTest.JSON_PROPERTY_OUTER_ENUM,
EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER,
@ -169,6 +170,44 @@ public class EnumTest {
public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer";
private EnumIntegerEnum enumInteger;
/**
* Gets or Sets enumIntegerOnly
*/
public enum EnumIntegerOnlyEnum {
NUMBER_2(2),
NUMBER_MINUS_2(-2);
private Integer value;
EnumIntegerOnlyEnum(Integer value) {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static EnumIntegerOnlyEnum fromValue(Integer value) {
for (EnumIntegerOnlyEnum b : EnumIntegerOnlyEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_ENUM_INTEGER_ONLY = "enum_integer_only";
private EnumIntegerOnlyEnum enumIntegerOnly;
/**
* Gets or Sets enumNumber
*/
@ -297,6 +336,31 @@ public class EnumTest {
}
public EnumTest enumIntegerOnly(EnumIntegerOnlyEnum enumIntegerOnly) {
this.enumIntegerOnly = enumIntegerOnly;
return this;
}
/**
* Get enumIntegerOnly
* @return enumIntegerOnly
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public EnumIntegerOnlyEnum getEnumIntegerOnly() {
return enumIntegerOnly;
}
@JsonProperty(JSON_PROPERTY_ENUM_INTEGER_ONLY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEnumIntegerOnly(EnumIntegerOnlyEnum enumIntegerOnly) {
this.enumIntegerOnly = enumIntegerOnly;
}
public EnumTest enumNumber(EnumNumberEnum enumNumber) {
this.enumNumber = enumNumber;
return this;
@ -445,6 +509,7 @@ public class EnumTest {
return Objects.equals(this.enumString, enumTest.enumString) &&
Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) &&
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
Objects.equals(this.enumIntegerOnly, enumTest.enumIntegerOnly) &&
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
equalsNullable(this.outerEnum, enumTest.outerEnum) &&
Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) &&
@ -458,7 +523,7 @@ public class EnumTest {
@Override
public int hashCode() {
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
return Objects.hash(enumString, enumStringRequired, enumInteger, enumIntegerOnly, enumNumber, hashCodeNullable(outerEnum), outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
@ -475,6 +540,7 @@ public class EnumTest {
sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n");
sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n");
sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n");
sb.append(" enumIntegerOnly: ").append(toIndentedString(enumIntegerOnly)).append("\n");
sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n");
sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n");
sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n");
@ -542,6 +608,11 @@ public class EnumTest {
joiner.add(String.format("%senum_integer%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEnumInteger()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `enum_integer_only` to the URL query string
if (getEnumIntegerOnly() != null) {
joiner.add(String.format("%senum_integer_only%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEnumIntegerOnly()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `enum_number` to the URL query string
if (getEnumNumber() != null) {
joiner.add(String.format("%senum_number%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEnumNumber()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));

View File

@ -0,0 +1,186 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* EquilateralTriangle
*/
@JsonPropertyOrder({
EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE,
EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class EquilateralTriangle {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public EquilateralTriangle() {
}
public EquilateralTriangle shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public EquilateralTriangle triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this EquilateralTriangle object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EquilateralTriangle equilateralTriangle = (EquilateralTriangle) o;
return Objects.equals(this.shapeType, equilateralTriangle.shapeType) &&
Objects.equals(this.triangleType, equilateralTriangle.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EquilateralTriangle {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,297 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Fruit.FruitDeserializer.class)
@JsonSerialize(using = Fruit.FruitSerializer.class)
public class Fruit extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Fruit.class.getName());
public static class FruitSerializer extends StdSerializer<Fruit> {
public FruitSerializer(Class<Fruit> t) {
super(t);
}
public FruitSerializer() {
this(null);
}
@Override
public void serialize(Fruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class FruitDeserializer extends StdDeserializer<Fruit> {
public FruitDeserializer() {
this(Fruit.class);
}
public FruitDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Fruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Apple
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Apple.class.equals(Integer.class) || Apple.class.equals(Long.class) || Apple.class.equals(Float.class) || Apple.class.equals(Double.class) || Apple.class.equals(Boolean.class) || Apple.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Apple.class.equals(Integer.class) || Apple.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Apple.class.equals(Float.class) || Apple.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Apple.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Apple.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Apple'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Apple'", e);
}
// deserialize Banana
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Banana.class.equals(Integer.class) || Banana.class.equals(Long.class) || Banana.class.equals(Float.class) || Banana.class.equals(Double.class) || Banana.class.equals(Boolean.class) || Banana.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Banana.class.equals(Integer.class) || Banana.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Banana.class.equals(Float.class) || Banana.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Banana.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Banana.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Banana'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Banana'", e);
}
if (match == 1) {
Fruit ret = new Fruit();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Fruit: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Fruit getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Fruit cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Fruit() {
super("oneOf", Boolean.FALSE);
}
public Fruit(Apple o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Fruit(Banana o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Apple", Apple.class);
schemas.put("Banana", Banana.class);
JSON.registerDescendants(Fruit.class, Collections.unmodifiableMap(schemas));
}
@Override
public Map<String, Class<?>> getSchemas() {
return Fruit.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Apple, Banana
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Apple.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Banana.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Apple, Banana");
}
/**
* Get the actual instance, which can be the following:
* Apple, Banana
*
* @return The actual instance (Apple, Banana)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Apple`. If the actual instance is not `Apple`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Apple`
* @throws ClassCastException if the instance is not `Apple`
*/
public Apple getApple() throws ClassCastException {
return (Apple)super.getActualInstance();
}
/**
* Get the actual instance of `Banana`. If the actual instance is not `Banana`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Banana`
* @throws ClassCastException if the instance is not `Banana`
*/
public Banana getBanana() throws ClassCastException {
return (Banana)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof Apple) {
if (getActualInstance() != null) {
joiner.add(((Apple)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Banana) {
if (getActualInstance() != null) {
joiner.add(((Banana)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,297 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.AppleReq;
import org.openapitools.client.model.BananaReq;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = FruitReq.FruitReqDeserializer.class)
@JsonSerialize(using = FruitReq.FruitReqSerializer.class)
public class FruitReq extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(FruitReq.class.getName());
public static class FruitReqSerializer extends StdSerializer<FruitReq> {
public FruitReqSerializer(Class<FruitReq> t) {
super(t);
}
public FruitReqSerializer() {
this(null);
}
@Override
public void serialize(FruitReq value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class FruitReqDeserializer extends StdDeserializer<FruitReq> {
public FruitReqDeserializer() {
this(FruitReq.class);
}
public FruitReqDeserializer(Class<?> vc) {
super(vc);
}
@Override
public FruitReq deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize AppleReq
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class) || AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class) || AppleReq.class.equals(Boolean.class) || AppleReq.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((AppleReq.class.equals(Integer.class) || AppleReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((AppleReq.class.equals(Float.class) || AppleReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (AppleReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (AppleReq.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(AppleReq.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'AppleReq'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'AppleReq'", e);
}
// deserialize BananaReq
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class) || BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class) || BananaReq.class.equals(Boolean.class) || BananaReq.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((BananaReq.class.equals(Integer.class) || BananaReq.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((BananaReq.class.equals(Float.class) || BananaReq.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (BananaReq.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (BananaReq.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(BananaReq.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'BananaReq'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'BananaReq'", e);
}
if (match == 1) {
FruitReq ret = new FruitReq();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for FruitReq: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public FruitReq getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "FruitReq cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public FruitReq() {
super("oneOf", Boolean.FALSE);
}
public FruitReq(AppleReq o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public FruitReq(BananaReq o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("AppleReq", AppleReq.class);
schemas.put("BananaReq", BananaReq.class);
JSON.registerDescendants(FruitReq.class, Collections.unmodifiableMap(schemas));
}
@Override
public Map<String, Class<?>> getSchemas() {
return FruitReq.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* AppleReq, BananaReq
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(AppleReq.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(BananaReq.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq");
}
/**
* Get the actual instance, which can be the following:
* AppleReq, BananaReq
*
* @return The actual instance (AppleReq, BananaReq)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `AppleReq`. If the actual instance is not `AppleReq`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `AppleReq`
* @throws ClassCastException if the instance is not `AppleReq`
*/
public AppleReq getAppleReq() throws ClassCastException {
return (AppleReq)super.getActualInstance();
}
/**
* Get the actual instance of `BananaReq`. If the actual instance is not `BananaReq`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `BananaReq`
* @throws ClassCastException if the instance is not `BananaReq`
*/
public BananaReq getBananaReq() throws ClassCastException {
return (BananaReq)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof AppleReq) {
if (getActualInstance() != null) {
joiner.add(((AppleReq)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof BananaReq) {
if (getActualInstance() != null) {
joiner.add(((BananaReq)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,208 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using=GmFruit.GmFruitDeserializer.class)
@JsonSerialize(using = GmFruit.GmFruitSerializer.class)
public class GmFruit extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(GmFruit.class.getName());
public static class GmFruitSerializer extends StdSerializer<GmFruit> {
public GmFruitSerializer(Class<GmFruit> t) {
super(t);
}
public GmFruitSerializer() {
this(null);
}
@Override
public void serialize(GmFruit value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class GmFruitDeserializer extends StdDeserializer<GmFruit> {
public GmFruitDeserializer() {
this(GmFruit.class);
}
public GmFruitDeserializer(Class<?> vc) {
super(vc);
}
@Override
public GmFruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
// deserialize Apple
try {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class);
GmFruit ret = new GmFruit();
ret.setActualInstance(deserialized);
return ret;
} catch (Exception e) {
// deserialization failed, continue, log to help debugging
log.log(Level.FINER, "Input data does not match 'GmFruit'", e);
}
// deserialize Banana
try {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class);
GmFruit ret = new GmFruit();
ret.setActualInstance(deserialized);
return ret;
} catch (Exception e) {
// deserialization failed, continue, log to help debugging
log.log(Level.FINER, "Input data does not match 'GmFruit'", e);
}
throw new IOException(String.format("Failed deserialization for GmFruit: no match found"));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public GmFruit getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "GmFruit cannot be null");
}
}
// store a list of schema names defined in anyOf
public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>();
public GmFruit() {
super("anyOf", Boolean.FALSE);
}
public GmFruit(Apple o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
public GmFruit(Banana o) {
super("anyOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Apple", Apple.class);
schemas.put("Banana", Banana.class);
JSON.registerDescendants(GmFruit.class, Collections.unmodifiableMap(schemas));
}
@Override
public Map<String, Class<?>> getSchemas() {
return GmFruit.schemas;
}
/**
* Set the instance that matches the anyOf child schema, check
* the instance parameter is valid against the anyOf child schemas:
* Apple, Banana
*
* It could be an instance of the 'anyOf' schemas.
* The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Apple.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Banana.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Apple, Banana");
}
/**
* Get the actual instance, which can be the following:
* Apple, Banana
*
* @return The actual instance (Apple, Banana)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Apple`. If the actual instance is not `Apple`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Apple`
* @throws ClassCastException if the instance is not `Apple`
*/
public Apple getApple() throws ClassCastException {
return (Apple)super.getActualInstance();
}
/**
* Get the actual instance of `Banana`. If the actual instance is not `Banana`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Banana`
* @throws ClassCastException if the instance is not `Banana`
*/
public Banana getBanana() throws ClassCastException {
return (Banana)super.getActualInstance();
}
}

View File

@ -0,0 +1,174 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.ChildCat;
import org.openapitools.client.model.ParentPet;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* GrandparentAnimal
*/
@JsonPropertyOrder({
GrandparentAnimal.JSON_PROPERTY_PET_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonIgnoreProperties(
value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the pet_type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"),
@JsonSubTypes.Type(value = ParentPet.class, name = "ParentPet"),
})
public class GrandparentAnimal {
public static final String JSON_PROPERTY_PET_TYPE = "pet_type";
private String petType;
public GrandparentAnimal() {
}
public GrandparentAnimal petType(String petType) {
this.petType = petType;
return this;
}
/**
* Get petType
* @return petType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getPetType() {
return petType;
}
@JsonProperty(JSON_PROPERTY_PET_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setPetType(String petType) {
this.petType = petType;
}
/**
* Return true if this GrandparentAnimal object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GrandparentAnimal grandparentAnimal = (GrandparentAnimal) o;
return Objects.equals(this.petType, grandparentAnimal.petType);
}
@Override
public int hashCode() {
return Objects.hash(petType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class GrandparentAnimal {\n");
sb.append(" petType: ").append(toIndentedString(petType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
static {
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ChildCat", ChildCat.class);
mappings.put("ParentPet", ParentPet.class);
mappings.put("GrandparentAnimal", GrandparentAnimal.class);
JSON.registerDiscriminator(GrandparentAnimal.class, "pet_type", mappings);
}
}

View File

@ -0,0 +1,186 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* IsoscelesTriangle
*/
@JsonPropertyOrder({
IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE,
IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class IsoscelesTriangle {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public IsoscelesTriangle() {
}
public IsoscelesTriangle shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public IsoscelesTriangle triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this IsoscelesTriangle object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
IsoscelesTriangle isoscelesTriangle = (IsoscelesTriangle) o;
return Objects.equals(this.shapeType, isoscelesTriangle.shapeType) &&
Objects.equals(this.triangleType, isoscelesTriangle.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class IsoscelesTriangle {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,361 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Pig;
import org.openapitools.client.model.Whale;
import org.openapitools.client.model.Zebra;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Mammal.MammalDeserializer.class)
@JsonSerialize(using = Mammal.MammalSerializer.class)
public class Mammal extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Mammal.class.getName());
public static class MammalSerializer extends StdSerializer<Mammal> {
public MammalSerializer(Class<Mammal> t) {
super(t);
}
public MammalSerializer() {
this(null);
}
@Override
public void serialize(Mammal value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class MammalDeserializer extends StdDeserializer<Mammal> {
public MammalDeserializer() {
this(Mammal.class);
}
public MammalDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Mammal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Pig
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Pig.class.equals(Integer.class) || Pig.class.equals(Long.class) || Pig.class.equals(Float.class) || Pig.class.equals(Double.class) || Pig.class.equals(Boolean.class) || Pig.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Pig.class.equals(Integer.class) || Pig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Pig.class.equals(Float.class) || Pig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Pig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Pig.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Pig'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Pig'", e);
}
// deserialize Whale
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Whale.class.equals(Integer.class) || Whale.class.equals(Long.class) || Whale.class.equals(Float.class) || Whale.class.equals(Double.class) || Whale.class.equals(Boolean.class) || Whale.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Whale.class.equals(Integer.class) || Whale.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Whale.class.equals(Float.class) || Whale.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Whale.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Whale.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Whale'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Whale'", e);
}
// deserialize Zebra
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class) || Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class) || Zebra.class.equals(Boolean.class) || Zebra.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Zebra.class.equals(Integer.class) || Zebra.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Zebra.class.equals(Float.class) || Zebra.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Zebra.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Zebra.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Zebra'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Zebra'", e);
}
if (match == 1) {
Mammal ret = new Mammal();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Mammal: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Mammal getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Mammal cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Mammal() {
super("oneOf", Boolean.FALSE);
}
public Mammal(Pig o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Mammal(Whale o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Mammal(Zebra o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Pig", Pig.class);
schemas.put("Whale", Whale.class);
schemas.put("Zebra", Zebra.class);
JSON.registerDescendants(Mammal.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Pig", Pig.class);
mappings.put("whale", Whale.class);
mappings.put("zebra", Zebra.class);
mappings.put("mammal", Mammal.class);
JSON.registerDiscriminator(Mammal.class, "className", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Mammal.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Pig, Whale, Zebra
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Pig.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Whale.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Zebra.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra");
}
/**
* Get the actual instance, which can be the following:
* Pig, Whale, Zebra
*
* @return The actual instance (Pig, Whale, Zebra)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Pig`. If the actual instance is not `Pig`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Pig`
* @throws ClassCastException if the instance is not `Pig`
*/
public Pig getPig() throws ClassCastException {
return (Pig)super.getActualInstance();
}
/**
* Get the actual instance of `Whale`. If the actual instance is not `Whale`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Whale`
* @throws ClassCastException if the instance is not `Whale`
*/
public Whale getWhale() throws ClassCastException {
return (Whale)super.getActualInstance();
}
/**
* Get the actual instance of `Zebra`. If the actual instance is not `Zebra`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Zebra`
* @throws ClassCastException if the instance is not `Zebra`
*/
public Zebra getZebra() throws ClassCastException {
return (Zebra)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof Whale) {
if (getActualInstance() != null) {
joiner.add(((Whale)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Zebra) {
if (getActualInstance() != null) {
joiner.add(String.format("%sone_of_1%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getActualInstance()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
if (getActualInstance() instanceof Pig) {
if (getActualInstance() != null) {
joiner.add(((Pig)getActualInstance()).toUrlQueryString(prefix + "one_of_2" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,312 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = NullableShape.NullableShapeDeserializer.class)
@JsonSerialize(using = NullableShape.NullableShapeSerializer.class)
public class NullableShape extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(NullableShape.class.getName());
public static class NullableShapeSerializer extends StdSerializer<NullableShape> {
public NullableShapeSerializer(Class<NullableShape> t) {
super(t);
}
public NullableShapeSerializer() {
this(null);
}
@Override
public void serialize(NullableShape value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class NullableShapeDeserializer extends StdDeserializer<NullableShape> {
public NullableShapeDeserializer() {
this(NullableShape.class);
}
public NullableShapeDeserializer(Class<?> vc) {
super(vc);
}
@Override
public NullableShape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Quadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
attemptParsing |= (token == JsonToken.VALUE_NULL);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Quadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e);
}
// deserialize Triangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
attemptParsing |= (token == JsonToken.VALUE_NULL);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Triangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Triangle'", e);
}
if (match == 1) {
NullableShape ret = new NullableShape();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for NullableShape: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public NullableShape getNullValue(DeserializationContext ctxt) throws JsonMappingException {
return null;
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public NullableShape() {
super("oneOf", Boolean.TRUE);
}
public NullableShape(Quadrilateral o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}
public NullableShape(Triangle o) {
super("oneOf", Boolean.TRUE);
setActualInstance(o);
}
static {
schemas.put("Quadrilateral", Quadrilateral.class);
schemas.put("Triangle", Triangle.class);
JSON.registerDescendants(NullableShape.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Quadrilateral", Quadrilateral.class);
mappings.put("Triangle", Triangle.class);
mappings.put("NullableShape", NullableShape.class);
JSON.registerDiscriminator(NullableShape.class, "shapeType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return NullableShape.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Quadrilateral, Triangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (instance == null) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Triangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle");
}
/**
* Get the actual instance, which can be the following:
* Quadrilateral, Triangle
*
* @return The actual instance (Quadrilateral, Triangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Quadrilateral`
* @throws ClassCastException if the instance is not `Quadrilateral`
*/
public Quadrilateral getQuadrilateral() throws ClassCastException {
return (Quadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `Triangle`. If the actual instance is not `Triangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Triangle`
* @throws ClassCastException if the instance is not `Triangle`
*/
public Triangle getTriangle() throws ClassCastException {
return (Triangle)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof Triangle) {
if (getActualInstance() != null) {
joiner.add(((Triangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Quadrilateral) {
if (getActualInstance() != null) {
joiner.add(((Quadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,142 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.ChildCat;
import org.openapitools.client.model.GrandparentAnimal;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* ParentPet
*/
@JsonPropertyOrder({
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonIgnoreProperties(
value = "pet_type", // ignore manually set pet_type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the pet_type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "pet_type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"),
})
public class ParentPet extends GrandparentAnimal {
public ParentPet() {
}
/**
* Return true if this ParentPet object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ParentPet {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `pet_type` to the URL query string
if (getPetType() != null) {
joiner.add(String.format("%spet_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getPetType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
static {
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ChildCat", ChildCat.class);
mappings.put("ParentPet", ParentPet.class);
JSON.registerDiscriminator(ParentPet.class, "pet_type", mappings);
}
}

View File

@ -25,11 +25,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@ -58,7 +55,7 @@ public class Pet {
private String name;
public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls";
private Set<String> photoUrls = new LinkedHashSet<>();
private List<String> photoUrls = new ArrayList<>();
public static final String JSON_PROPERTY_TAGS = "tags";
private List<Tag> tags = null;
@ -181,7 +178,7 @@ public class Pet {
}
public Pet photoUrls(Set<String> photoUrls) {
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ -199,15 +196,14 @@ public class Pet {
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public Set<String> getPhotoUrls() {
public List<String> getPhotoUrls() {
return photoUrls;
}
@JsonDeserialize(as = LinkedHashSet.class)
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setPhotoUrls(Set<String> photoUrls) {
public void setPhotoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
}
@ -369,13 +365,11 @@ public class Pet {
// add `photoUrls` to the URL query string
if (getPhotoUrls() != null) {
int i = 0;
for (String _item : getPhotoUrls()) {
for (int i = 0; i < getPhotoUrls().size(); i++) {
joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(_item), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
URLEncoder.encode(String.valueOf(getPhotoUrls().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
i++;
}
// add `tags` to the URL query string

View File

@ -0,0 +1,305 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.BasquePig;
import org.openapitools.client.model.DanishPig;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Pig.PigDeserializer.class)
@JsonSerialize(using = Pig.PigSerializer.class)
public class Pig extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Pig.class.getName());
public static class PigSerializer extends StdSerializer<Pig> {
public PigSerializer(Class<Pig> t) {
super(t);
}
public PigSerializer() {
this(null);
}
@Override
public void serialize(Pig value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class PigDeserializer extends StdDeserializer<Pig> {
public PigDeserializer() {
this(Pig.class);
}
public PigDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Pig deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize BasquePig
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class) || BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class) || BasquePig.class.equals(Boolean.class) || BasquePig.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((BasquePig.class.equals(Integer.class) || BasquePig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((BasquePig.class.equals(Float.class) || BasquePig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (BasquePig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (BasquePig.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'BasquePig'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'BasquePig'", e);
}
// deserialize DanishPig
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class) || DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class) || DanishPig.class.equals(Boolean.class) || DanishPig.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((DanishPig.class.equals(Integer.class) || DanishPig.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((DanishPig.class.equals(Float.class) || DanishPig.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (DanishPig.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (DanishPig.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'DanishPig'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'DanishPig'", e);
}
if (match == 1) {
Pig ret = new Pig();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Pig: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Pig getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Pig cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Pig() {
super("oneOf", Boolean.FALSE);
}
public Pig(BasquePig o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Pig(DanishPig o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("BasquePig", BasquePig.class);
schemas.put("DanishPig", DanishPig.class);
JSON.registerDescendants(Pig.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("BasquePig", BasquePig.class);
mappings.put("DanishPig", DanishPig.class);
mappings.put("Pig", Pig.class);
JSON.registerDiscriminator(Pig.class, "className", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Pig.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* BasquePig, DanishPig
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(BasquePig.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(DanishPig.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig");
}
/**
* Get the actual instance, which can be the following:
* BasquePig, DanishPig
*
* @return The actual instance (BasquePig, DanishPig)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `BasquePig`. If the actual instance is not `BasquePig`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `BasquePig`
* @throws ClassCastException if the instance is not `BasquePig`
*/
public BasquePig getBasquePig() throws ClassCastException {
return (BasquePig)super.getActualInstance();
}
/**
* Get the actual instance of `DanishPig`. If the actual instance is not `DanishPig`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `DanishPig`
* @throws ClassCastException if the instance is not `DanishPig`
*/
public DanishPig getDanishPig() throws ClassCastException {
return (DanishPig)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof BasquePig) {
if (getActualInstance() != null) {
joiner.add(((BasquePig)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof DanishPig) {
if (getActualInstance() != null) {
joiner.add(((DanishPig)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,305 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.ComplexQuadrilateral;
import org.openapitools.client.model.SimpleQuadrilateral;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Quadrilateral.QuadrilateralDeserializer.class)
@JsonSerialize(using = Quadrilateral.QuadrilateralSerializer.class)
public class Quadrilateral extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Quadrilateral.class.getName());
public static class QuadrilateralSerializer extends StdSerializer<Quadrilateral> {
public QuadrilateralSerializer(Class<Quadrilateral> t) {
super(t);
}
public QuadrilateralSerializer() {
this(null);
}
@Override
public void serialize(Quadrilateral value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class QuadrilateralDeserializer extends StdDeserializer<Quadrilateral> {
public QuadrilateralDeserializer() {
this(Quadrilateral.class);
}
public QuadrilateralDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Quadrilateral deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize ComplexQuadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class) || ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class) || ComplexQuadrilateral.class.equals(Boolean.class) || ComplexQuadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((ComplexQuadrilateral.class.equals(Integer.class) || ComplexQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((ComplexQuadrilateral.class.equals(Float.class) || ComplexQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (ComplexQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (ComplexQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'ComplexQuadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'ComplexQuadrilateral'", e);
}
// deserialize SimpleQuadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class) || SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class) || SimpleQuadrilateral.class.equals(Boolean.class) || SimpleQuadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((SimpleQuadrilateral.class.equals(Integer.class) || SimpleQuadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((SimpleQuadrilateral.class.equals(Float.class) || SimpleQuadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (SimpleQuadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (SimpleQuadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'SimpleQuadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'SimpleQuadrilateral'", e);
}
if (match == 1) {
Quadrilateral ret = new Quadrilateral();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Quadrilateral: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Quadrilateral getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Quadrilateral cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Quadrilateral() {
super("oneOf", Boolean.FALSE);
}
public Quadrilateral(ComplexQuadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Quadrilateral(SimpleQuadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("ComplexQuadrilateral", ComplexQuadrilateral.class);
schemas.put("SimpleQuadrilateral", SimpleQuadrilateral.class);
JSON.registerDescendants(Quadrilateral.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("ComplexQuadrilateral", ComplexQuadrilateral.class);
mappings.put("SimpleQuadrilateral", SimpleQuadrilateral.class);
mappings.put("Quadrilateral", Quadrilateral.class);
JSON.registerDiscriminator(Quadrilateral.class, "quadrilateralType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Quadrilateral.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* ComplexQuadrilateral, SimpleQuadrilateral
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(ComplexQuadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(SimpleQuadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral");
}
/**
* Get the actual instance, which can be the following:
* ComplexQuadrilateral, SimpleQuadrilateral
*
* @return The actual instance (ComplexQuadrilateral, SimpleQuadrilateral)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `ComplexQuadrilateral`. If the actual instance is not `ComplexQuadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `ComplexQuadrilateral`
* @throws ClassCastException if the instance is not `ComplexQuadrilateral`
*/
public ComplexQuadrilateral getComplexQuadrilateral() throws ClassCastException {
return (ComplexQuadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `SimpleQuadrilateral`. If the actual instance is not `SimpleQuadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `SimpleQuadrilateral`
* @throws ClassCastException if the instance is not `SimpleQuadrilateral`
*/
public SimpleQuadrilateral getSimpleQuadrilateral() throws ClassCastException {
return (SimpleQuadrilateral)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof SimpleQuadrilateral) {
if (getActualInstance() != null) {
joiner.add(((SimpleQuadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof ComplexQuadrilateral) {
if (getActualInstance() != null) {
joiner.add(((ComplexQuadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,150 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* QuadrilateralInterface
*/
@JsonPropertyOrder({
QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class QuadrilateralInterface {
public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType";
private String quadrilateralType;
public QuadrilateralInterface() {
}
public QuadrilateralInterface quadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
return this;
}
/**
* Get quadrilateralType
* @return quadrilateralType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getQuadrilateralType() {
return quadrilateralType;
}
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setQuadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
}
/**
* Return true if this QuadrilateralInterface object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
QuadrilateralInterface quadrilateralInterface = (QuadrilateralInterface) o;
return Objects.equals(this.quadrilateralType, quadrilateralInterface.quadrilateralType);
}
@Override
public int hashCode() {
return Objects.hash(quadrilateralType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class QuadrilateralInterface {\n");
sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `quadrilateralType` to the URL query string
if (getQuadrilateralType() != null) {
joiner.add(String.format("%squadrilateralType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getQuadrilateralType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,186 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ScaleneTriangle
*/
@JsonPropertyOrder({
ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE,
ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ScaleneTriangle {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public ScaleneTriangle() {
}
public ScaleneTriangle shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public ScaleneTriangle triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this ScaleneTriangle object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ScaleneTriangle scaleneTriangle = (ScaleneTriangle) o;
return Objects.equals(this.shapeType, scaleneTriangle.shapeType) &&
Objects.equals(this.triangleType, scaleneTriangle.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ScaleneTriangle {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,305 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Shape.ShapeDeserializer.class)
@JsonSerialize(using = Shape.ShapeSerializer.class)
public class Shape extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Shape.class.getName());
public static class ShapeSerializer extends StdSerializer<Shape> {
public ShapeSerializer(Class<Shape> t) {
super(t);
}
public ShapeSerializer() {
this(null);
}
@Override
public void serialize(Shape value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class ShapeDeserializer extends StdDeserializer<Shape> {
public ShapeDeserializer() {
this(Shape.class);
}
public ShapeDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Shape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Quadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Quadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e);
}
// deserialize Triangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Triangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Triangle'", e);
}
if (match == 1) {
Shape ret = new Shape();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Shape: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Shape getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Shape cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Shape() {
super("oneOf", Boolean.FALSE);
}
public Shape(Quadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Shape(Triangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Quadrilateral", Quadrilateral.class);
schemas.put("Triangle", Triangle.class);
JSON.registerDescendants(Shape.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Quadrilateral", Quadrilateral.class);
mappings.put("Triangle", Triangle.class);
mappings.put("Shape", Shape.class);
JSON.registerDiscriminator(Shape.class, "shapeType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Shape.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Quadrilateral, Triangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Triangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle");
}
/**
* Get the actual instance, which can be the following:
* Quadrilateral, Triangle
*
* @return The actual instance (Quadrilateral, Triangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Quadrilateral`
* @throws ClassCastException if the instance is not `Quadrilateral`
*/
public Quadrilateral getQuadrilateral() throws ClassCastException {
return (Quadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `Triangle`. If the actual instance is not `Triangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Triangle`
* @throws ClassCastException if the instance is not `Triangle`
*/
public Triangle getTriangle() throws ClassCastException {
return (Triangle)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof Triangle) {
if (getActualInstance() != null) {
joiner.add(((Triangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Quadrilateral) {
if (getActualInstance() != null) {
joiner.add(((Quadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,150 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* ShapeInterface
*/
@JsonPropertyOrder({
ShapeInterface.JSON_PROPERTY_SHAPE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ShapeInterface {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public ShapeInterface() {
}
public ShapeInterface shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
/**
* Return true if this ShapeInterface object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ShapeInterface shapeInterface = (ShapeInterface) o;
return Objects.equals(this.shapeType, shapeInterface.shapeType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ShapeInterface {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,305 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.Quadrilateral;
import org.openapitools.client.model.Triangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = ShapeOrNull.ShapeOrNullDeserializer.class)
@JsonSerialize(using = ShapeOrNull.ShapeOrNullSerializer.class)
public class ShapeOrNull extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName());
public static class ShapeOrNullSerializer extends StdSerializer<ShapeOrNull> {
public ShapeOrNullSerializer(Class<ShapeOrNull> t) {
super(t);
}
public ShapeOrNullSerializer() {
this(null);
}
@Override
public void serialize(ShapeOrNull value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class ShapeOrNullDeserializer extends StdDeserializer<ShapeOrNull> {
public ShapeOrNullDeserializer() {
this(ShapeOrNull.class);
}
public ShapeOrNullDeserializer(Class<?> vc) {
super(vc);
}
@Override
public ShapeOrNull deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize Quadrilateral
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class) || Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class) || Quadrilateral.class.equals(Boolean.class) || Quadrilateral.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Quadrilateral.class.equals(Integer.class) || Quadrilateral.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Quadrilateral.class.equals(Float.class) || Quadrilateral.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Quadrilateral.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Quadrilateral.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Quadrilateral'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e);
}
// deserialize Triangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class) || Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class) || Triangle.class.equals(Boolean.class) || Triangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((Triangle.class.equals(Integer.class) || Triangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((Triangle.class.equals(Float.class) || Triangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (Triangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Triangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'Triangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Triangle'", e);
}
if (match == 1) {
ShapeOrNull ret = new ShapeOrNull();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for ShapeOrNull: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public ShapeOrNull getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "ShapeOrNull cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public ShapeOrNull() {
super("oneOf", Boolean.FALSE);
}
public ShapeOrNull(Quadrilateral o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public ShapeOrNull(Triangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("Quadrilateral", Quadrilateral.class);
schemas.put("Triangle", Triangle.class);
JSON.registerDescendants(ShapeOrNull.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("Quadrilateral", Quadrilateral.class);
mappings.put("Triangle", Triangle.class);
mappings.put("ShapeOrNull", ShapeOrNull.class);
JSON.registerDiscriminator(ShapeOrNull.class, "shapeType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return ShapeOrNull.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* Quadrilateral, Triangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(Quadrilateral.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Triangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle");
}
/**
* Get the actual instance, which can be the following:
* Quadrilateral, Triangle
*
* @return The actual instance (Quadrilateral, Triangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `Quadrilateral`. If the actual instance is not `Quadrilateral`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Quadrilateral`
* @throws ClassCastException if the instance is not `Quadrilateral`
*/
public Quadrilateral getQuadrilateral() throws ClassCastException {
return (Quadrilateral)super.getActualInstance();
}
/**
* Get the actual instance of `Triangle`. If the actual instance is not `Triangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `Triangle`
* @throws ClassCastException if the instance is not `Triangle`
*/
public Triangle getTriangle() throws ClassCastException {
return (Triangle)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof Triangle) {
if (getActualInstance() != null) {
joiner.add(((Triangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof Quadrilateral) {
if (getActualInstance() != null) {
joiner.add(((Quadrilateral)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,186 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* SimpleQuadrilateral
*/
@JsonPropertyOrder({
SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE,
SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SimpleQuadrilateral {
public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType";
private String shapeType;
public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType";
private String quadrilateralType;
public SimpleQuadrilateral() {
}
public SimpleQuadrilateral shapeType(String shapeType) {
this.shapeType = shapeType;
return this;
}
/**
* Get shapeType
* @return shapeType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getShapeType() {
return shapeType;
}
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setShapeType(String shapeType) {
this.shapeType = shapeType;
}
public SimpleQuadrilateral quadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
return this;
}
/**
* Get quadrilateralType
* @return quadrilateralType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getQuadrilateralType() {
return quadrilateralType;
}
@JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setQuadrilateralType(String quadrilateralType) {
this.quadrilateralType = quadrilateralType;
}
/**
* Return true if this SimpleQuadrilateral object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SimpleQuadrilateral simpleQuadrilateral = (SimpleQuadrilateral) o;
return Objects.equals(this.shapeType, simpleQuadrilateral.shapeType) &&
Objects.equals(this.quadrilateralType, simpleQuadrilateral.quadrilateralType);
}
@Override
public int hashCode() {
return Objects.hash(shapeType, quadrilateralType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SimpleQuadrilateral {\n");
sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n");
sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `shapeType` to the URL query string
if (getShapeType() != null) {
joiner.add(String.format("%sshapeType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getShapeType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `quadrilateralType` to the URL query string
if (getQuadrilateralType() != null) {
joiner.add(String.format("%squadrilateralType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getQuadrilateralType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -32,13 +32,17 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
* SpecialModelName
*/
@JsonPropertyOrder({
SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME
SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME,
SpecialModelName.JSON_PROPERTY_SPECIAL_MODEL_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SpecialModelName {
public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]";
private Long $specialPropertyName;
public static final String JSON_PROPERTY_SPECIAL_MODEL_NAME = "_special_model.name_";
private String specialModelName;
public SpecialModelName() {
}
@ -67,6 +71,31 @@ public class SpecialModelName {
}
public SpecialModelName specialModelName(String specialModelName) {
this.specialModelName = specialModelName;
return this;
}
/**
* Get specialModelName
* @return specialModelName
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSpecialModelName() {
return specialModelName;
}
@JsonProperty(JSON_PROPERTY_SPECIAL_MODEL_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSpecialModelName(String specialModelName) {
this.specialModelName = specialModelName;
}
/**
* Return true if this _special_model.name_ object is equal to o.
*/
@ -79,12 +108,13 @@ public class SpecialModelName {
return false;
}
SpecialModelName specialModelName = (SpecialModelName) o;
return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName);
return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName) &&
Objects.equals(this.specialModelName, specialModelName.specialModelName);
}
@Override
public int hashCode() {
return Objects.hash($specialPropertyName);
return Objects.hash($specialPropertyName, specialModelName);
}
@Override
@ -92,6 +122,7 @@ public class SpecialModelName {
StringBuilder sb = new StringBuilder();
sb.append("class SpecialModelName {\n");
sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n");
sb.append(" specialModelName: ").append(toIndentedString(specialModelName)).append("\n");
sb.append("}");
return sb.toString();
}
@ -144,6 +175,11 @@ public class SpecialModelName {
joiner.add(String.format("%s$special[property.name]%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(get$SpecialPropertyName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `_special_model.name_` to the URL query string
if (getSpecialModelName() != null) {
joiner.add(String.format("%s_special_model.name_%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSpecialModelName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,361 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.EquilateralTriangle;
import org.openapitools.client.model.IsoscelesTriangle;
import org.openapitools.client.model.ScaleneTriangle;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.openapitools.client.JSON;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@JsonDeserialize(using = Triangle.TriangleDeserializer.class)
@JsonSerialize(using = Triangle.TriangleSerializer.class)
public class Triangle extends AbstractOpenApiSchema {
private static final Logger log = Logger.getLogger(Triangle.class.getName());
public static class TriangleSerializer extends StdSerializer<Triangle> {
public TriangleSerializer(Class<Triangle> t) {
super(t);
}
public TriangleSerializer() {
this(null);
}
@Override
public void serialize(Triangle value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeObject(value.getActualInstance());
}
}
public static class TriangleDeserializer extends StdDeserializer<Triangle> {
public TriangleDeserializer() {
this(Triangle.class);
}
public TriangleDeserializer(Class<?> vc) {
super(vc);
}
@Override
public Triangle deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = jp.readValueAsTree();
Object deserialized = null;
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// deserialize EquilateralTriangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class) || EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class) || EquilateralTriangle.class.equals(Boolean.class) || EquilateralTriangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((EquilateralTriangle.class.equals(Integer.class) || EquilateralTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((EquilateralTriangle.class.equals(Float.class) || EquilateralTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (EquilateralTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (EquilateralTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'EquilateralTriangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'EquilateralTriangle'", e);
}
// deserialize IsoscelesTriangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class) || IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class) || IsoscelesTriangle.class.equals(Boolean.class) || IsoscelesTriangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((IsoscelesTriangle.class.equals(Integer.class) || IsoscelesTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((IsoscelesTriangle.class.equals(Float.class) || IsoscelesTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (IsoscelesTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (IsoscelesTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'IsoscelesTriangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'IsoscelesTriangle'", e);
}
// deserialize ScaleneTriangle
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class) || ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class) || ScaleneTriangle.class.equals(Boolean.class) || ScaleneTriangle.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |= ((ScaleneTriangle.class.equals(Integer.class) || ScaleneTriangle.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |= ((ScaleneTriangle.class.equals(Float.class) || ScaleneTriangle.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |= (ScaleneTriangle.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (ScaleneTriangle.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(Level.FINER, "Input data matches schema 'ScaleneTriangle'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'ScaleneTriangle'", e);
}
if (match == 1) {
Triangle ret = new Triangle();
ret.setActualInstance(deserialized);
return ret;
}
throw new IOException(String.format("Failed deserialization for Triangle: %d classes match result, expected 1", match));
}
/**
* Handle deserialization of the 'null' value.
*/
@Override
public Triangle getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "Triangle cannot be null");
}
}
// store a list of schema names defined in oneOf
public static final Map<String, Class<?>> schemas = new HashMap<>();
public Triangle() {
super("oneOf", Boolean.FALSE);
}
public Triangle(EquilateralTriangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Triangle(IsoscelesTriangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
public Triangle(ScaleneTriangle o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
static {
schemas.put("EquilateralTriangle", EquilateralTriangle.class);
schemas.put("IsoscelesTriangle", IsoscelesTriangle.class);
schemas.put("ScaleneTriangle", ScaleneTriangle.class);
JSON.registerDescendants(Triangle.class, Collections.unmodifiableMap(schemas));
// Initialize and register the discriminator mappings.
Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
mappings.put("EquilateralTriangle", EquilateralTriangle.class);
mappings.put("IsoscelesTriangle", IsoscelesTriangle.class);
mappings.put("ScaleneTriangle", ScaleneTriangle.class);
mappings.put("Triangle", Triangle.class);
JSON.registerDiscriminator(Triangle.class, "triangleType", mappings);
}
@Override
public Map<String, Class<?>> getSchemas() {
return Triangle.schemas;
}
/**
* Set the instance that matches the oneOf child schema, check
* the instance parameter is valid against the oneOf child schemas:
* EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle
*
* It could be an instance of the 'oneOf' schemas.
* The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf).
*/
@Override
public void setActualInstance(Object instance) {
if (JSON.isInstanceOf(EquilateralTriangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(IsoscelesTriangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(ScaleneTriangle.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle");
}
/**
* Get the actual instance, which can be the following:
* EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle
*
* @return The actual instance (EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle)
*/
@Override
public Object getActualInstance() {
return super.getActualInstance();
}
/**
* Get the actual instance of `EquilateralTriangle`. If the actual instance is not `EquilateralTriangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `EquilateralTriangle`
* @throws ClassCastException if the instance is not `EquilateralTriangle`
*/
public EquilateralTriangle getEquilateralTriangle() throws ClassCastException {
return (EquilateralTriangle)super.getActualInstance();
}
/**
* Get the actual instance of `IsoscelesTriangle`. If the actual instance is not `IsoscelesTriangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `IsoscelesTriangle`
* @throws ClassCastException if the instance is not `IsoscelesTriangle`
*/
public IsoscelesTriangle getIsoscelesTriangle() throws ClassCastException {
return (IsoscelesTriangle)super.getActualInstance();
}
/**
* Get the actual instance of `ScaleneTriangle`. If the actual instance is not `ScaleneTriangle`,
* the ClassCastException will be thrown.
*
* @return The actual instance of `ScaleneTriangle`
* @throws ClassCastException if the instance is not `ScaleneTriangle`
*/
public ScaleneTriangle getScaleneTriangle() throws ClassCastException {
return (ScaleneTriangle)super.getActualInstance();
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
if (getActualInstance() instanceof EquilateralTriangle) {
if (getActualInstance() != null) {
joiner.add(((EquilateralTriangle)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof IsoscelesTriangle) {
if (getActualInstance() != null) {
joiner.add(((IsoscelesTriangle)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix));
}
return joiner.toString();
}
if (getActualInstance() instanceof ScaleneTriangle) {
if (getActualInstance() != null) {
joiner.add(((ScaleneTriangle)getActualInstance()).toUrlQueryString(prefix + "one_of_2" + suffix));
}
return joiner.toString();
}
return null;
}
}

View File

@ -0,0 +1,150 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* TriangleInterface
*/
@JsonPropertyOrder({
TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class TriangleInterface {
public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType";
private String triangleType;
public TriangleInterface() {
}
public TriangleInterface triangleType(String triangleType) {
this.triangleType = triangleType;
return this;
}
/**
* Get triangleType
* @return triangleType
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getTriangleType() {
return triangleType;
}
@JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setTriangleType(String triangleType) {
this.triangleType = triangleType;
}
/**
* Return true if this TriangleInterface object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TriangleInterface triangleInterface = (TriangleInterface) o;
return Objects.equals(this.triangleType, triangleInterface.triangleType);
}
@Override
public int hashCode() {
return Objects.hash(triangleType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TriangleInterface {\n");
sb.append(" triangleType: ").append(toIndentedString(triangleType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `triangleType` to the URL query string
if (getTriangleType() != null) {
joiner.add(String.format("%striangleType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTriangleType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -25,6 +25,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@ -39,7 +43,11 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
User.JSON_PROPERTY_EMAIL,
User.JSON_PROPERTY_PASSWORD,
User.JSON_PROPERTY_PHONE,
User.JSON_PROPERTY_USER_STATUS
User.JSON_PROPERTY_USER_STATUS,
User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS,
User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE,
User.JSON_PROPERTY_ANY_TYPE_PROP,
User.JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class User {
@ -67,6 +75,18 @@ public class User {
public static final String JSON_PROPERTY_USER_STATUS = "userStatus";
private Integer userStatus;
public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps";
private Object objectWithNoDeclaredProps;
public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable";
private JsonNullable<Object> objectWithNoDeclaredPropsNullable = JsonNullable.<Object>undefined();
public static final String JSON_PROPERTY_ANY_TYPE_PROP = "anyTypeProp";
private JsonNullable<Object> anyTypeProp = JsonNullable.<Object>of(null);
public static final String JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable";
private JsonNullable<Object> anyTypePropNullable = JsonNullable.<Object>of(null);
public User() {
}
@ -270,6 +290,130 @@ public class User {
}
public User objectWithNoDeclaredProps(Object objectWithNoDeclaredProps) {
this.objectWithNoDeclaredProps = objectWithNoDeclaredProps;
return this;
}
/**
* test code generation for objects Value must be a map of strings to values. It cannot be the &#39;null&#39; value.
* @return objectWithNoDeclaredProps
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Object getObjectWithNoDeclaredProps() {
return objectWithNoDeclaredProps;
}
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setObjectWithNoDeclaredProps(Object objectWithNoDeclaredProps) {
this.objectWithNoDeclaredProps = objectWithNoDeclaredProps;
}
public User objectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) {
this.objectWithNoDeclaredPropsNullable = JsonNullable.<Object>of(objectWithNoDeclaredPropsNullable);
return this;
}
/**
* test code generation for nullable objects. Value must be a map of strings to values or the &#39;null&#39; value.
* @return objectWithNoDeclaredPropsNullable
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getObjectWithNoDeclaredPropsNullable() {
return objectWithNoDeclaredPropsNullable.orElse(null);
}
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getObjectWithNoDeclaredPropsNullable_JsonNullable() {
return objectWithNoDeclaredPropsNullable;
}
@JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE)
public void setObjectWithNoDeclaredPropsNullable_JsonNullable(JsonNullable<Object> objectWithNoDeclaredPropsNullable) {
this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable;
}
public void setObjectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) {
this.objectWithNoDeclaredPropsNullable = JsonNullable.<Object>of(objectWithNoDeclaredPropsNullable);
}
public User anyTypeProp(Object anyTypeProp) {
this.anyTypeProp = JsonNullable.<Object>of(anyTypeProp);
return this;
}
/**
* test code generation for any type Here the &#39;type&#39; attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389
* @return anyTypeProp
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getAnyTypeProp() {
return anyTypeProp.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getAnyTypeProp_JsonNullable() {
return anyTypeProp;
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP)
public void setAnyTypeProp_JsonNullable(JsonNullable<Object> anyTypeProp) {
this.anyTypeProp = anyTypeProp;
}
public void setAnyTypeProp(Object anyTypeProp) {
this.anyTypeProp = JsonNullable.<Object>of(anyTypeProp);
}
public User anyTypePropNullable(Object anyTypePropNullable) {
this.anyTypePropNullable = JsonNullable.<Object>of(anyTypePropNullable);
return this;
}
/**
* test code generation for any type Here the &#39;type&#39; attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The &#39;nullable&#39; attribute does not change the allowed values.
* @return anyTypePropNullable
**/
@javax.annotation.Nullable
@JsonIgnore
public Object getAnyTypePropNullable() {
return anyTypePropNullable.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Object> getAnyTypePropNullable_JsonNullable() {
return anyTypePropNullable;
}
@JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE)
public void setAnyTypePropNullable_JsonNullable(JsonNullable<Object> anyTypePropNullable) {
this.anyTypePropNullable = anyTypePropNullable;
}
public void setAnyTypePropNullable(Object anyTypePropNullable) {
this.anyTypePropNullable = JsonNullable.<Object>of(anyTypePropNullable);
}
/**
* Return true if this User object is equal to o.
*/
@ -289,12 +433,27 @@ public class User {
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
Objects.equals(this.userStatus, user.userStatus) &&
Objects.equals(this.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) &&
equalsNullable(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) &&
equalsNullable(this.anyTypeProp, user.anyTypeProp) &&
equalsNullable(this.anyTypePropNullable, user.anyTypePropNullable);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, hashCodeNullable(objectWithNoDeclaredPropsNullable), hashCodeNullable(anyTypeProp), hashCodeNullable(anyTypePropNullable));
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
@ -309,6 +468,10 @@ public class User {
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
sb.append(" objectWithNoDeclaredProps: ").append(toIndentedString(objectWithNoDeclaredProps)).append("\n");
sb.append(" objectWithNoDeclaredPropsNullable: ").append(toIndentedString(objectWithNoDeclaredPropsNullable)).append("\n");
sb.append(" anyTypeProp: ").append(toIndentedString(anyTypeProp)).append("\n");
sb.append(" anyTypePropNullable: ").append(toIndentedString(anyTypePropNullable)).append("\n");
sb.append("}");
return sb.toString();
}
@ -396,6 +559,26 @@ public class User {
joiner.add(String.format("%suserStatus%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getUserStatus()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `objectWithNoDeclaredProps` to the URL query string
if (getObjectWithNoDeclaredProps() != null) {
joiner.add(String.format("%sobjectWithNoDeclaredProps%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getObjectWithNoDeclaredProps()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `objectWithNoDeclaredPropsNullable` to the URL query string
if (getObjectWithNoDeclaredPropsNullable() != null) {
joiner.add(String.format("%sobjectWithNoDeclaredPropsNullable%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getObjectWithNoDeclaredPropsNullable()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `anyTypeProp` to the URL query string
if (getAnyTypeProp() != null) {
joiner.add(String.format("%sanyTypeProp%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAnyTypeProp()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `anyTypePropNullable` to the URL query string
if (getAnyTypePropNullable() != null) {
joiner.add(String.format("%sanyTypePropNullable%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAnyTypePropNullable()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,222 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Whale
*/
@JsonPropertyOrder({
Whale.JSON_PROPERTY_HAS_BALEEN,
Whale.JSON_PROPERTY_HAS_TEETH,
Whale.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Whale {
public static final String JSON_PROPERTY_HAS_BALEEN = "hasBaleen";
private Boolean hasBaleen;
public static final String JSON_PROPERTY_HAS_TEETH = "hasTeeth";
private Boolean hasTeeth;
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public Whale() {
}
public Whale hasBaleen(Boolean hasBaleen) {
this.hasBaleen = hasBaleen;
return this;
}
/**
* Get hasBaleen
* @return hasBaleen
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_HAS_BALEEN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getHasBaleen() {
return hasBaleen;
}
@JsonProperty(JSON_PROPERTY_HAS_BALEEN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setHasBaleen(Boolean hasBaleen) {
this.hasBaleen = hasBaleen;
}
public Whale hasTeeth(Boolean hasTeeth) {
this.hasTeeth = hasTeeth;
return this;
}
/**
* Get hasTeeth
* @return hasTeeth
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_HAS_TEETH)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getHasTeeth() {
return hasTeeth;
}
@JsonProperty(JSON_PROPERTY_HAS_TEETH)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setHasTeeth(Boolean hasTeeth) {
this.hasTeeth = hasTeeth;
}
public Whale className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* Return true if this whale object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Whale whale = (Whale) o;
return Objects.equals(this.hasBaleen, whale.hasBaleen) &&
Objects.equals(this.hasTeeth, whale.hasTeeth) &&
Objects.equals(this.className, whale.className);
}
@Override
public int hashCode() {
return Objects.hash(hasBaleen, hasTeeth, className);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Whale {\n");
sb.append(" hasBaleen: ").append(toIndentedString(hasBaleen)).append("\n");
sb.append(" hasTeeth: ").append(toIndentedString(hasTeeth)).append("\n");
sb.append(" className: ").append(toIndentedString(className)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `hasBaleen` to the URL query string
if (getHasBaleen() != null) {
joiner.add(String.format("%shasBaleen%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getHasBaleen()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `hasTeeth` to the URL query string
if (getHasTeeth() != null) {
joiner.add(String.format("%shasTeeth%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getHasTeeth()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -0,0 +1,276 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Zebra
*/
@JsonPropertyOrder({
Zebra.JSON_PROPERTY_TYPE,
Zebra.JSON_PROPERTY_CLASS_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Zebra extends HashMap<String, Object> {
/**
* Gets or Sets type
*/
public enum TypeEnum {
PLAINS("plains"),
MOUNTAIN("mountain"),
GREVYS("grevys");
private String value;
TypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static TypeEnum fromValue(String value) {
for (TypeEnum b : TypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_TYPE = "type";
private TypeEnum type;
public static final String JSON_PROPERTY_CLASS_NAME = "className";
private String className;
public Zebra() {
}
public Zebra type(TypeEnum type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public TypeEnum getType() {
return type;
}
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(TypeEnum type) {
this.type = type;
}
public Zebra className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getClassName() {
return className;
}
@JsonProperty(JSON_PROPERTY_CLASS_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setClassName(String className) {
this.className = className;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
* @param key the name of the property
* @param value the value of the property
* @return self reference
*/
@JsonAnySetter
public Zebra putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) properties.
* @return the additional (undeclared) properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
* @param key the name of the property
* @return the additional (undeclared) property with the specified name
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
/**
* Return true if this zebra object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Zebra zebra = (Zebra) o;
return Objects.equals(this.type, zebra.type) &&
Objects.equals(this.className, zebra.className)&&
Objects.equals(this.additionalProperties, zebra.additionalProperties) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(type, className, super.hashCode(), additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Zebra {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" className: ").append(toIndentedString(className)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `type` to the URL query string
if (getType() != null) {
joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `className` to the URL query string
if (getClassName() != null) {
joiner.add(String.format("%sclassName%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClassName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}

View File

@ -16,15 +16,13 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import org.openapitools.client.model.EnumClass;
import java.io.File;
import org.openapitools.client.model.FileSchemaTestClass;
import org.openapitools.client.model.HealthCheckResult;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.OuterObjectWithEnumProperty;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.OuterEnum;
import org.openapitools.client.model.User;
import org.junit.Test;
import org.junit.Ignore;
@ -62,25 +60,6 @@ public class FakeApiTest {
// TODO: test validations
}
/**
* test http signature authentication
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void fakeHttpSignatureTestTest() throws ApiException {
Pet pet = null;
String query1 = null;
String header1 = null;
CompletableFuture<Void> response = api.fakeHttpSignatureTest(pet, query1, header1);
// TODO: test validations
}
/**
*
*
@ -150,18 +129,17 @@ public class FakeApiTest {
}
/**
*
* Array of Enums
*
* Test serialization of enum (int) properties with examples
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void fakePropertyEnumIntegerSerializeTest() throws ApiException {
OuterObjectWithEnumProperty outerObjectWithEnumProperty = null;
CompletableFuture<OuterObjectWithEnumProperty> response =
api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
public void getArrayOfEnumsTest() throws ApiException {
CompletableFuture<List<OuterEnum>> response =
api.getArrayOfEnums();
// TODO: test validations
}
@ -169,24 +147,7 @@ public class FakeApiTest {
/**
*
*
* For this test, the body has to be a binary file.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testBodyWithBinaryTest() throws ApiException {
File body = null;
CompletableFuture<Void> response = api.testBodyWithBinary(body);
// TODO: test validations
}
/**
*
*
* For this test, the body for this request must reference a schema named &#x60;File&#x60;.
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
*
* @throws ApiException
* if the Api call fails
@ -281,11 +242,10 @@ public class FakeApiTest {
String enumQueryString = null;
Integer enumQueryInteger = null;
Double enumQueryDouble = null;
List<EnumClass> enumQueryModelArray = null;
List<String> enumFormStringArray = null;
String enumFormString = null;
CompletableFuture<Void> response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString);
CompletableFuture<Void> response = api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
// TODO: test validations
}
@ -371,10 +331,8 @@ public class FakeApiTest {
List<String> http = null;
List<String> url = null;
List<String> context = null;
String allowEmpty = null;
Map<String, String> language = null;
CompletableFuture<Void> response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language);
CompletableFuture<Void> response = api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
// TODO: test validations
}

View File

@ -17,7 +17,6 @@ import org.openapitools.client.ApiException;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import org.junit.Test;
import org.junit.Ignore;
@ -100,8 +99,8 @@ public class PetApiTest {
*/
@Test
public void findPetsByTagsTest() throws ApiException {
Set<String> tags = null;
CompletableFuture<Set<Pet>> response =
List<String> tags = null;
CompletableFuture<List<Pet>> response =
api.findPetsByTags(tags);
// TODO: test validations

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for AppleReq
*/
public class AppleReqTest {
private final AppleReq model = new AppleReq();
/**
* Model tests for AppleReq
*/
@Test
public void testAppleReq() {
// TODO: test AppleReq
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'mealy'
*/
@Test
public void mealyTest() {
// TODO: test mealy
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Apple
*/
public class AppleTest {
private final Apple model = new Apple();
/**
* Model tests for Apple
*/
@Test
public void testApple() {
// TODO: test Apple
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'origin'
*/
@Test
public void originTest() {
// TODO: test origin
}
}

View File

@ -0,0 +1,57 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for BananaReq
*/
public class BananaReqTest {
private final BananaReq model = new BananaReq();
/**
* Model tests for BananaReq
*/
@Test
public void testBananaReq() {
// TODO: test BananaReq
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
/**
* Test the property 'sweet'
*/
@Test
public void sweetTest() {
// TODO: test sweet
}
}

View File

@ -0,0 +1,49 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Banana
*/
public class BananaTest {
private final Banana model = new Banana();
/**
* Model tests for Banana
*/
@Test
public void testBanana() {
// TODO: test Banana
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
}

View File

@ -0,0 +1,48 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for BasquePig
*/
public class BasquePigTest {
private final BasquePig model = new BasquePig();
/**
* Model tests for BasquePig
*/
@Test
public void testBasquePig() {
// TODO: test BasquePig
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
}

View File

@ -0,0 +1,58 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Set;
import java.util.HashSet;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ChildCatAllOf
*/
public class ChildCatAllOfTest {
private final ChildCatAllOf model = new ChildCatAllOf();
/**
* Model tests for ChildCatAllOf
*/
@Test
public void testChildCatAllOf() {
// TODO: test ChildCatAllOf
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
/**
* Test the property 'petType'
*/
@Test
public void petTypeTest() {
// TODO: test petType
}
}

View File

@ -0,0 +1,62 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.client.model.ParentPet;
import java.util.Set;
import java.util.HashSet;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ChildCat
*/
public class ChildCatTest {
private final ChildCat model = new ChildCat();
/**
* Model tests for ChildCat
*/
@Test
public void testChildCat() {
// TODO: test ChildCat
}
/**
* Test the property 'petType'
*/
@Test
public void petTypeTest() {
// TODO: test petType
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ComplexQuadrilateral
*/
public class ComplexQuadrilateralTest {
private final ComplexQuadrilateral model = new ComplexQuadrilateral();
/**
* Model tests for ComplexQuadrilateral
*/
@Test
public void testComplexQuadrilateral() {
// TODO: test ComplexQuadrilateral
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'quadrilateralType'
*/
@Test
public void quadrilateralTypeTest() {
// TODO: test quadrilateralType
}
}

View File

@ -0,0 +1,48 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for DanishPig
*/
public class DanishPigTest {
private final DanishPig model = new DanishPig();
/**
* Model tests for DanishPig
*/
@Test
public void testDanishPig() {
// TODO: test DanishPig
}
/**
* Test the property 'className'
*/
@Test
public void classNameTest() {
// TODO: test className
}
}

View File

@ -0,0 +1,84 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.client.model.Fruit;
import org.openapitools.client.model.NullableShape;
import org.openapitools.client.model.Shape;
import org.openapitools.client.model.ShapeOrNull;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Drawing
*/
public class DrawingTest {
private final Drawing model = new Drawing();
/**
* Model tests for Drawing
*/
@Test
public void testDrawing() {
// TODO: test Drawing
}
/**
* Test the property 'mainShape'
*/
@Test
public void mainShapeTest() {
// TODO: test mainShape
}
/**
* Test the property 'shapeOrNull'
*/
@Test
public void shapeOrNullTest() {
// TODO: test shapeOrNull
}
/**
* Test the property 'nullableShape'
*/
@Test
public void nullableShapeTest() {
// TODO: test nullableShape
}
/**
* Test the property 'shapes'
*/
@Test
public void shapesTest() {
// TODO: test shapes
}
}

View File

@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for EquilateralTriangle
*/
public class EquilateralTriangleTest {
private final EquilateralTriangle model = new EquilateralTriangle();
/**
* Model tests for EquilateralTriangle
*/
@Test
public void testEquilateralTriangle() {
// TODO: test EquilateralTriangle
}
/**
* Test the property 'shapeType'
*/
@Test
public void shapeTypeTest() {
// TODO: test shapeType
}
/**
* Test the property 'triangleType'
*/
@Test
public void triangleTypeTest() {
// TODO: test triangleType
}
}

View File

@ -0,0 +1,75 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.AppleReq;
import org.openapitools.client.model.BananaReq;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for FruitReq
*/
public class FruitReqTest {
private final FruitReq model = new FruitReq();
/**
* Model tests for FruitReq
*/
@Test
public void testFruitReq() {
// TODO: test FruitReq
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'mealy'
*/
@Test
public void mealyTest() {
// TODO: test mealy
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
/**
* Test the property 'sweet'
*/
@Test
public void sweetTest() {
// TODO: test sweet
}
}

View File

@ -0,0 +1,67 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import org.openapitools.client.model.Apple;
import org.openapitools.client.model.Banana;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Fruit
*/
public class FruitTest {
private final Fruit model = new Fruit();
/**
* Model tests for Fruit
*/
@Test
public void testFruit() {
// TODO: test Fruit
}
/**
* Test the property 'cultivar'
*/
@Test
public void cultivarTest() {
// TODO: test cultivar
}
/**
* Test the property 'origin'
*/
@Test
public void originTest() {
// TODO: test origin
}
/**
* Test the property 'lengthCm'
*/
@Test
public void lengthCmTest() {
// TODO: test lengthCm
}
}

Some files were not shown because too many files have changed in this diff Show More