From a4d3c4dd8e3ded6ba649b4bc9f7e34b8fe4fe55a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 4 Jun 2020 23:10:30 +0800 Subject: [PATCH 1/4] fix cast error for datetimeoff in java --- .../languages/AbstractJavaCodegen.java | 6 +- pom.xml | 2 +- .../petstore/java/jersey2-java8/README.md | 1 + .../java/jersey2-java8/api/openapi.yaml | 32 +++++++++- .../java/jersey2-java8/docs/FakeApi.md | 62 ++++++++++++++++++- 5 files changed, 98 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index badec0f64994..ec05101519f3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -18,7 +18,6 @@ package org.openapitools.codegen.languages; import com.google.common.base.Strings; - import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; @@ -42,7 +41,6 @@ import java.util.*; import java.util.regex.Pattern; -import static org.openapitools.codegen.utils.OnceLogger.once; import static org.openapitools.codegen.utils.StringUtils.*; public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig { @@ -863,9 +861,13 @@ public String toDefaultValue(Schema schema) { Date date = (Date) schema.getDefault(); LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); return String.format(Locale.ROOT, localDate.toString(), ""); + } else if (schema.getDefault() instanceof java.time.OffsetDateTime) { + return String.format(Locale.ROOT, + ((java.time.OffsetDateTime) schema.getDefault()).atZoneSameInstant(ZoneId.systemDefault()).toString(), ""); } else { _default = (String) schema.getDefault(); } + if (schema.getEnum() == null) { return "\"" + escapeText(_default) + "\""; } else { diff --git a/pom.xml b/pom.xml index 6dd6eb52a993..9a6a76e3cd77 100644 --- a/pom.xml +++ b/pom.xml @@ -1264,7 +1264,7 @@ samples/client/petstore/java/feign10x samples/client/petstore/java/jersey1 samples/client/petstore/java/jersey2-java8 - + samples/openapi3/client/petstore/java/jersey2-java8 samples/client/petstore/java/okhttp-gson samples/client/petstore/java/retrofit2 samples/client/petstore/java/retrofit2rx diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/README.md b/samples/openapi3/client/petstore/java/jersey2-java8/README.md index fed6ba75e3de..cb77330f025a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/README.md @@ -113,6 +113,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | *FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +*FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums *FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml index b254bf2c4b1e..373650648fe1 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml @@ -895,7 +895,9 @@ paths: 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: @@ -1234,6 +1236,20 @@ paths: tags: - fake x-accepts: application/json + /fake/array-of-enums: + get: + operationId: getArrayOfEnums + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayOfEnums' + description: Got named array of enums + summary: Array of Enums + tags: + - fake + x-accepts: application/json components: requestBodies: UserArray: @@ -1309,7 +1325,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: @@ -1323,6 +1339,7 @@ components: format: int32 type: integer shipDate: + example: 2020-02-02T20:20:20.000222Z format: date-time type: string status: @@ -1602,9 +1619,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: @@ -2214,6 +2233,15 @@ components: 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 inline_response_default: example: string: @@ -2314,7 +2342,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: diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md index 184fa525ad6b..29e37b5770e3 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model @@ -340,6 +341,65 @@ No authorization required | **200** | Output string | - | +## getArrayOfEnums + +> List<OuterEnum> getArrayOfEnums() + +Array of Enums + +### 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; + +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); + try { + List result = apiInstance.getArrayOfEnums(); + System.out.println(result); + } catch (ApiException e) { + 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()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**List<OuterEnum>**](OuterEnum.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Got named array of enums | - | + + ## testBodyWithFileSchema > testBodyWithFileSchema(fileSchemaTestClass) @@ -610,7 +670,7 @@ Name | Type | Description | Notes **string** | **String**| None | [optional] **binary** | **File**| None | [optional] **date** | **LocalDate**| None | [optional] - **dateTime** | **OffsetDateTime**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]] **password** | **String**| None | [optional] **paramCallback** | **String**| None | [optional] From 932cd08c42ac2f26dd0b695d775305fdfe75c765 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 4 Jun 2020 23:11:05 +0800 Subject: [PATCH 2/4] add back files --- .../petstore/java/jersey2-java8/.gitignore | 21 + .../jersey2-java8/.openapi-generator-ignore | 23 + .../petstore/java/jersey2-java8/.travis.yml | 22 + .../petstore/java/jersey2-java8/build.gradle | 125 ++ .../petstore/java/jersey2-java8/build.sbt | 25 + .../petstore/java/jersey2-java8/git_push.sh | 58 + .../java/jersey2-java8/gradle.properties | 2 + .../petstore/java/jersey2-java8/gradlew | 183 +++ .../petstore/java/jersey2-java8/gradlew.bat | 100 ++ .../petstore/java/jersey2-java8/pom.xml | 305 ++++ .../java/jersey2-java8/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiClient.java | 1287 +++++++++++++++++ .../org/openapitools/client/ApiException.java | 94 ++ .../org/openapitools/client/ApiResponse.java | 74 + .../openapitools/client/Configuration.java | 39 + .../java/org/openapitools/client/JSON.java | 49 + .../java/org/openapitools/client/Pair.java | 61 + .../client/RFC3339DateFormat.java | 32 + .../client/ServerConfiguration.java | 58 + .../openapitools/client/ServerVariable.java | 23 + .../org/openapitools/client/StringUtil.java | 83 ++ .../client/api/AnotherFakeApi.java | 115 ++ .../openapitools/client/api/DefaultApi.java | 108 ++ .../org/openapitools/client/api/FakeApi.java | 1257 ++++++++++++++++ .../client/api/FakeClassnameTags123Api.java | 115 ++ .../org/openapitools/client/api/PetApi.java | 697 +++++++++ .../org/openapitools/client/api/StoreApi.java | 316 ++++ .../org/openapitools/client/api/UserApi.java | 588 ++++++++ .../openapitools/client/auth/ApiKeyAuth.java | 79 + .../client/auth/Authentication.java | 33 + .../client/auth/HttpBasicAuth.java | 56 + .../client/auth/HttpBearerAuth.java | 62 + .../client/auth/HttpSignatureAuth.java | 265 ++++ .../org/openapitools/client/auth/OAuth.java | 183 +++ .../openapitools/client/auth/OAuthFlow.java | 18 + .../client/model/AbstractOpenApiSchema.java | 127 ++ .../model/AdditionalPropertiesClass.java | 367 +++++ .../org/openapitools/client/model/Animal.java | 142 ++ .../org/openapitools/client/model/Apple.java | 133 ++ .../openapitools/client/model/AppleReq.java | 132 ++ .../model/ArrayOfArrayOfNumberOnly.java | 113 ++ .../client/model/ArrayOfNumberOnly.java | 113 ++ .../openapitools/client/model/ArrayTest.java | 191 +++ .../org/openapitools/client/model/Banana.java | 103 ++ .../openapitools/client/model/BananaReq.java | 133 ++ .../openapitools/client/model/BasquePig.java | 101 ++ .../client/model/Capitalization.java | 257 ++++ .../org/openapitools/client/model/Cat.java | 112 ++ .../openapitools/client/model/CatAllOf.java | 102 ++ .../openapitools/client/model/Category.java | 132 ++ .../openapitools/client/model/ChildCat.java | 112 ++ .../client/model/ChildCatAllOf.java | 102 ++ .../openapitools/client/model/ClassModel.java | 103 ++ .../org/openapitools/client/model/Client.java | 102 ++ .../client/model/ComplexQuadrilateral.java | 133 ++ .../openapitools/client/model/DanishPig.java | 101 ++ .../org/openapitools/client/model/Dog.java | 112 ++ .../openapitools/client/model/DogAllOf.java | 102 ++ .../openapitools/client/model/Drawing.java | 226 +++ .../openapitools/client/model/EnumArrays.java | 213 +++ .../openapitools/client/model/EnumClass.java | 60 + .../openapitools/client/model/EnumTest.java | 479 ++++++ .../client/model/EquilateralTriangle.java | 133 ++ .../client/model/FileSchemaTestClass.java | 143 ++ .../org/openapitools/client/model/Foo.java | 102 ++ .../openapitools/client/model/FormatTest.java | 547 +++++++ .../org/openapitools/client/model/Fruit.java | 141 ++ .../openapitools/client/model/FruitReq.java | 141 ++ .../openapitools/client/model/GmFruit.java | 134 ++ .../client/model/GrandparentAnimal.java | 111 ++ .../client/model/HasOnlyReadOnly.java | 115 ++ .../client/model/HealthCheckResult.java | 116 ++ .../client/model/InlineObject.java | 133 ++ .../client/model/InlineObject1.java | 134 ++ .../client/model/InlineObject2.java | 215 +++ .../client/model/InlineObject3.java | 514 +++++++ .../client/model/InlineObject4.java | 131 ++ .../client/model/InlineObject5.java | 133 ++ .../client/model/InlineResponseDefault.java | 103 ++ .../client/model/IsoscelesTriangle.java | 133 ++ .../org/openapitools/client/model/Mammal.java | 165 +++ .../openapitools/client/model/MapTest.java | 265 ++++ ...ropertiesAndAdditionalPropertiesClass.java | 178 +++ .../client/model/Model200Response.java | 134 ++ .../client/model/ModelApiResponse.java | 164 +++ .../client/model/ModelReturn.java | 103 ++ .../org/openapitools/client/model/Name.java | 177 +++ .../client/model/NullableClass.java | 619 ++++++++ .../client/model/NullableShape.java | 142 ++ .../openapitools/client/model/NumberOnly.java | 103 ++ .../org/openapitools/client/model/Order.java | 295 ++++ .../client/model/OuterComposite.java | 165 +++ .../openapitools/client/model/OuterEnum.java | 60 + .../client/model/OuterEnumDefaultValue.java | 60 + .../client/model/OuterEnumInteger.java | 60 + .../model/OuterEnumIntegerDefaultValue.java | 60 + .../openapitools/client/model/ParentPet.java | 81 ++ .../org/openapitools/client/model/Pet.java | 309 ++++ .../org/openapitools/client/model/Pig.java | 142 ++ .../client/model/Quadrilateral.java | 142 ++ .../client/model/QuadrilateralInterface.java | 101 ++ .../client/model/ReadOnlyFirst.java | 124 ++ .../client/model/ScaleneTriangle.java | 133 ++ .../org/openapitools/client/model/Shape.java | 142 ++ .../client/model/ShapeInterface.java | 101 ++ .../client/model/ShapeOrNull.java | 142 ++ .../client/model/SimpleQuadrilateral.java | 133 ++ .../client/model/SpecialModelName.java | 102 ++ .../org/openapitools/client/model/Tag.java | 133 ++ .../openapitools/client/model/Triangle.java | 165 +++ .../client/model/TriangleInterface.java | 101 ++ .../org/openapitools/client/model/User.java | 476 ++++++ .../org/openapitools/client/model/Whale.java | 163 +++ .../org/openapitools/client/model/Zebra.java | 173 +++ 115 files changed, 19455 insertions(+) create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/.gitignore create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/.travis.yml create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/build.gradle create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/build.sbt create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/git_push.sh create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/gradlew create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/pom.xml create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/settings.gradle create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/AndroidManifest.xml create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Fruit.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FruitReq.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GmFruit.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject1.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject2.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject4.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject5.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Mammal.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableShape.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumInteger.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pig.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Quadrilateral.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Shape.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeOrNull.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Triangle.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java create mode 100644 samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/.gitignore b/samples/openapi3/client/petstore/java/jersey2-java8/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator-ignore b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/.travis.yml b/samples/openapi3/client/petstore/java/jersey2-java8/.travis.yml new file mode 100644 index 000000000000..e3bdf2af1bea --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/.travis.yml @@ -0,0 +1,22 @@ +# +# Generated by OpenAPI Generator: https://openapi-generator.tech +# +# Ref: https://docs.travis-ci.com/user/languages/java/ +# +language: java +jdk: + - openjdk12 + - openjdk11 + - openjdk10 + - openjdk9 + - openjdk8 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + #- mvn test + # test using gradle + - gradle test + # test using sbt + # - sbt test diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle new file mode 100644 index 000000000000..6c7675d844bc --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle @@ -0,0 +1,125 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + maven { url "https://repo1.maven.org/maven2" } + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven' + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + install { + repositories.mavenInstaller { + pom.artifactId = 'petstore-openapi3-jersey2-java8' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.5.22" + jackson_version = "2.10.3" + jackson_databind_version = "2.10.4" + jackson_databind_nullable_version = "0.2.1" + jersey_version = "2.27" + junit_version = "4.13" + scribejava_apis_version = "6.9.0" + tomitribe_http_signatures_version = "1.3" +} + +dependencies { + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "com.google.code.findbugs:jsr305:3.0.2" + compile "org.glassfish.jersey.core:jersey-client:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + compile "com.github.scribejava:scribejava-apis:$scribejava_apis_version" + compile "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version" + testCompile "junit:junit:$junit_version" +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt new file mode 100644 index 000000000000..f83f373eda21 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt @@ -0,0 +1,25 @@ +lazy val root = (project in file(".")). + settings( + organization := "org.openapitools", + name := "petstore-openapi3-jersey2-java8", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.22", + "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", + "com.fasterxml.jackson.core" % "jackson-core" % "2.10.4" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.4" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.4" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", + "com.github.scribejava" % "scribejava-apis" % "6.9.0" % "compile", + "org.tomitribe" % "tomitribe-http-signatures" % "1.3" % "compile", + "junit" % "junit" % "4.13" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/git_push.sh b/samples/openapi3/client/petstore/java/jersey2-java8/git_push.sh new file mode 100644 index 000000000000..ced3be2b0c7b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties b/samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties new file mode 100644 index 000000000000..05644f0754af --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/gradle.properties @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradlew b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew new file mode 100644 index 000000000000..2fe81a7d95e4 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat new file mode 100644 index 000000000000..9618d8d9607c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml new file mode 100644 index 000000000000..9652f6687d4c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml @@ -0,0 +1,305 @@ + + 4.0.0 + org.openapitools + petstore-openapi3-jersey2-java8 + jar + petstore-openapi3-jersey2-java8 + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M4 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + + org.glassfish.jersey.core + jersey-client + ${jersey-version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey-version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + org.tomitribe + tomitribe-http-signatures + ${http-signature-version} + + + com.github.scribejava + scribejava-apis + ${scribejava-apis-version} + + + + junit + junit + ${junit-version} + test + + + + UTF-8 + 1.6.1 + 2.30.1 + 2.10.4 + 2.10.4 + 0.2.1 + 4.13 + 1.4 + 6.9.0 + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/settings.gradle b/samples/openapi3/client/petstore/java/jersey2-java8/settings.gradle new file mode 100644 index 000000000000..e3652438a244 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-openapi3-jersey2-java8" \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/AndroidManifest.xml b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..67bb225a52eb --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,1287 @@ +package org.openapitools.client; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Form; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import com.github.scribejava.core.model.OAuth2AccessToken; +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.MultiPart; +import org.glassfish.jersey.media.multipart.MultiPartFeature; + +import java.io.IOException; +import java.io.InputStream; + +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import org.glassfish.jersey.logging.LoggingFeature; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.openapitools.client.auth.Authentication; +import org.openapitools.client.auth.HttpBasicAuth; +import org.openapitools.client.auth.HttpBearerAuth; +import org.openapitools.client.auth.HttpSignatureAuth; +import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.auth.OAuth; +import org.openapitools.client.model.AbstractOpenApiSchema; + + +public class ApiClient { + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String basePath = "http://petstore.swagger.io:80/v2"; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://{server}.swagger.io:{port}/v2", + "petstore server", + new HashMap() {{ + put("server", new ServerVariable( + "No description provided", + "petstore", + new HashSet( + Arrays.asList( + "petstore", + "qa-petstore", + "dev-petstore" + ) + ) + )); + put("port", new ServerVariable( + "No description provided", + "80", + new HashSet( + Arrays.asList( + "80", + "8080" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://localhost:8080/{version}", + "The local server", + new HashMap() {{ + put("version", new ServerVariable( + "No description provided", + "v2", + new HashSet( + Arrays.asList( + "v1", + "v2" + ) + ) + )); + }} + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected Map> operationServers = new HashMap>() {{ + put("PetApi.addPet", new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap() + ) + ))); + put("PetApi.updatePet", new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap() + ) + ))); + }}; + protected Map operationServerIndex = new HashMap(); + protected Map> operationServerVariables = new HashMap>(); + protected boolean debugging = false; + protected int connectionTimeout = 0; + private int readTimeout = 0; + + protected Client httpClient; + protected JSON json; + protected String tempFolderPath = null; + + protected Map authentications; + protected Map authenticationLookup; + + protected DateFormat dateFormat; + + /** + * Constructs a new ApiClient with default parameters. + */ + public ApiClient() { + this(null); + } + + /** + * Constructs a new ApiClient with the specified authentication parameters. + * + * @param authMap A hash map containing authentication parameters. + */ + public ApiClient(Map authMap) { + json = new JSON(); + httpClient = buildHttpClient(debugging); + + this.dateFormat = new RFC3339DateFormat(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + Authentication auth = null; + if (authMap != null) { + auth = authMap.get("api_key"); + } + if (auth instanceof ApiKeyAuth) { + authentications.put("api_key", auth); + } else { + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + } + if (authMap != null) { + auth = authMap.get("api_key_query"); + } + if (auth instanceof ApiKeyAuth) { + authentications.put("api_key_query", auth); + } else { + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + } + if (authMap != null) { + auth = authMap.get("bearer_test"); + } + if (auth instanceof HttpBearerAuth) { + authentications.put("bearer_test", auth); + } else { + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + } + if (authMap != null) { + auth = authMap.get("http_basic_test"); + } + if (auth instanceof HttpBasicAuth) { + authentications.put("http_basic_test", auth); + } else { + authentications.put("http_basic_test", new HttpBasicAuth()); + } + if (authMap != null) { + auth = authMap.get("http_signature_test"); + } + if (auth instanceof HttpSignatureAuth) { + authentications.put("http_signature_test", auth); + } + if (authMap != null) { + auth = authMap.get("petstore_auth"); + } + if (auth instanceof OAuth) { + authentications.put("petstore_auth", auth); + } else { + authentications.put("petstore_auth", new OAuth(basePath, "")); + } + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + // Setup authentication lookup (key: authentication alias, value: authentication name) + authenticationLookup = new HashMap(); + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * + * @return JSON + */ + public JSON getJSON() { + return json; + } + + public Client getHttpClient() { + return httpClient; + } + + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Returns the base URL to the location where the OpenAPI document is being served. + * + * @return The base URL to the target host. + */ + public String getBasePath() { + return basePath; + } + + /** + * Sets the base URL to the location where the OpenAPI document is being served. + * + * @param basePath The base URL to the target host. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + setOauthBasePath(basePath); + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + updateBasePath(); + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + updateBasePath(); + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + updateBasePath(); + return this; + } + + private void updateBasePath() { + if (serverIndex != null) { + setBasePath(servers.get(serverIndex).URL(serverVariables)); + } + } + + private void setOauthBasePath(String basePath) { + for(Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setBasePath(basePath); + } + } + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication object + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public ApiClient setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public ApiClient setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return this; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public ApiClient setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to configure authentications which respects aliases of API keys. + * + * @param secrets Hash map from authentication name to its secret. + */ + public ApiClient configureApiKeys(HashMap secrets) { + for (Map.Entry authEntry : authentications.entrySet()) { + Authentication auth = authEntry.getValue(); + if (auth instanceof ApiKeyAuth) { + String name = authEntry.getKey(); + // respect x-auth-id-alias property + name = authenticationLookup.containsKey(name) ? authenticationLookup.get(name) : name; + if (secrets.containsKey(name)) { + ((ApiKeyAuth) auth).setApiKey(secrets.get(name)); + } + } + } + return this; + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set bearer token for the first Bearer authentication. + * + * @param bearerToken Bearer token + */ + public ApiClient setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return this; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + + /** + * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken Access token + */ + public ApiClient setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the credentials for the first OAuth2 authentication. + * + * @param clientId the client ID + * @param clientSecret the client secret + */ + public ApiClient setOauthCredentials(String clientId, String clientSecret) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setCredentials(clientId, clientSecret); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the password flow for the first OAuth2 authentication. + * + * @param username the user name + * @param password the user password + */ + public ApiClient setOauthPasswordFlow(String username, String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).usePasswordFlow(username, password); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the authorization code flow for the first OAuth2 authentication. + * + * @param code the authorization code + */ + public ApiClient setOauthAuthorizationCodeFlow(String code) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).useAuthorizationCodeFlow(code); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set the scopes for the first OAuth2 authentication. + * + * @param scope the oauth scope + */ + public ApiClient setOauthScope(String scope) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setScope(scope); + return this; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent Http user agent + * @return API client + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return API client + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return API client + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * @return True if debugging is switched on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return API client + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(debugging); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Connect timeout (in milliseconds). + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param connectionTimeout Connection timeout in milliseconds + * @return API client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); + return this; + } + + /** + * read timeout (in milliseconds). + * @return Read timeout + */ + public int getReadTimeout() { + return readTimeout; + } + + /** + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param readTimeout Read timeout in milliseconds + * @return API client + */ + public ApiClient setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME + * @return True if the MIME type is JSON + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception + */ + public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { + Entity entity; + if (contentType.startsWith("multipart/form-data")) { + MultiPart multiPart = new MultiPart(); + for (Entry param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } else { + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + } + } + entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + } + return entity; + } + + /** + * Serialize the given Java object into string according the given + * Content-Type (only JSON, HTTP form is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return String + * @throws ApiException API exception + */ + public String serializeToString(Object obj, Map formParams, String contentType) throws ApiException { + try { + if (contentType.startsWith("multipart/form-data")) { + throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + String formString = ""; + for (Entry param : formParams.entrySet()) { + formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; + } + + if (formString.length() == 0) { // empty string + return formString; + } else { + return formString.substring(0, formString.length() - 1); + } + } else { + return json.getMapper().writeValueAsString(obj); + } + } catch (Exception ex) { + throw new ApiException("Failed to perform serializeToString: " + ex.toString()); + } + } + + public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{ + + Object result = null; + int matchCounter = 0; + ArrayList matchSchemas = new ArrayList<>(); + + if (schema.isNullable()) { + response.bufferEntity(); + if ("{}".equals(String.valueOf(response.readEntity(String.class))) || + "".equals(String.valueOf(response.readEntity(String.class)))) { + // schema is nullable and the response body is {} or empty string + return schema; + } + } + + for (Map.Entry entry : schema.getSchemas().entrySet()) { + String schemaName = entry.getKey(); + GenericType schemaType = entry.getValue(); + + if (schemaType instanceof GenericType) { // model + try { + Object deserializedObject = deserialize(response, schemaType); + if (deserializedObject != null) { + result = deserializedObject; + matchCounter++; + + if ("anyOf".equals(schema.getSchemaType())) { + break; + } else if ("oneOf".equals(schema.getSchemaType())) { + matchSchemas.add(schemaName); + } else { + throw new ApiException("Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); + } + } else { + // failed to deserialize the response in the schema provided, proceed to the next one if any + } + } catch (Exception ex) { + // failed to deserialize, do nothing and try next one (schema) + // Logging the error may be useful to troubleshoot why a payload fails to match + // the schema. + log.log(Level.FINE, "Input data does not match schema '" + schemaName + "'", ex); + } + } else {// unknown type + throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); + } + + } + + if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf + throw new ApiException("Response body is invalid as it matches more than one schema (" + StringUtil.join(matchSchemas, ", ") + ") defined in the oneOf model: " + schema.getClass().getName()); + } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas + throw new ApiException("Response body is invalid as it does not match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); + } else { // only one matched + schema.setActualInstance(result); + return schema; + } + + } + + + + /** + * Deserialize response body to Java object according to the Content-Type. + * @param Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, GenericType returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.getRawType() == File.class) { + // Handle file downloading. + T file = (T) downloadFileFromResponse(response); + return file; + } + + String contentType = null; + List contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + + // read the entity stream multiple times + response.bufferEntity(); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param Type + * @param operation The qualified name of the operation + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @param schema An instance of the response that uses oneOf/anyOf + * @return The response body in type of string + * @throws ApiException API exception + */ + public ApiResponse invokeAPI( + String operation, + String path, + String method, + List queryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String accept, + String contentType, + String[] authNames, + GenericType returnType, + AbstractOpenApiSchema schema) + throws ApiException { + + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + String targetURL; + if (serverIndex != null && operationServers.containsKey(operation)) { + Integer index = operationServerIndex.containsKey(operation) ? operationServerIndex.get(operation) : serverIndex; + Map variables = operationServerVariables.containsKey(operation) ? + operationServerVariables.get(operation) : serverVariables; + List serverConfigurations = operationServers.get(operation); + if (index < 0 || index >= serverConfigurations.size()) { + throw new ArrayIndexOutOfBoundsException( + String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", + index, serverConfigurations.size())); + } + targetURL = serverConfigurations.get(index).URL(variables) + path; + } else { + targetURL = this.basePath + path; + } + WebTarget target = httpClient.target(targetURL); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); + } + } + } + + Invocation.Builder invocationBuilder = target.request().accept(accept); + + for (Entry entry : cookieParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry entry : defaultCookieMap.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + Entity entity = serialize(body, formParams, contentType); + + // put all headers in one place + Map allHeaderParams = new HashMap<>(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + serializeToString(body, formParams, contentType), + method, + target.getUri()); + + for (Entry entry : allHeaderParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(entry.getKey(), value); + } + } + + Response response = null; + + try { + response = sendRequest(method, invocationBuilder, entity); + + // If OAuth is used and a status 401 is received, renew the access token and retry the request + if (response.getStatusInfo() == Status.UNAUTHORIZED) { + for (String authName : authNames) { + Authentication authentication = authentications.get(authName); + if (authentication instanceof OAuth) { + OAuth2AccessToken accessToken = ((OAuth) authentication).renewAccessToken(); + if (accessToken != null) { + invocationBuilder.header("Authorization", null); + invocationBuilder.header("Authorization", "Bearer " + accessToken.getAccessToken()); + response = sendRequest(method, invocationBuilder, entity); + } + break; + } + } + } + + int statusCode = response.getStatusInfo().getStatusCode(); + Map> responseHeaders = buildResponseHeaders(response); + + if (response.getStatusInfo() == Status.NO_CONTENT) { + return new ApiResponse(statusCode, responseHeaders); + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) return new ApiResponse(statusCode, responseHeaders); + else if (schema == null) { + return new ApiResponse(statusCode, responseHeaders, deserialize(response, returnType)); + } else { // oneOf/anyOf + return new ApiResponse( + statusCode, responseHeaders, (T) deserializeSchemas(response, schema)); + } + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), message, buildResponseHeaders(response), respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, + // just continue + } + } + } + + private Response sendRequest(String method, Invocation.Builder invocationBuilder, Entity entity) { + Response response; + if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.method("DELETE", entity); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else { + response = invocationBuilder.method(method); + } + return response; + } + + /** + * @deprecated Add qualified name of the operation as a first parameter. + */ + @Deprecated + public ApiResponse invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType, AbstractOpenApiSchema schema) throws ApiException { + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, schema); + } + + /** + * Build the Client used to make HTTP requests. + * @param debugging Debug setting + * @return Client + */ + protected Client buildHttpClient(boolean debugging) { + final ClientConfig clientConfig = new ClientConfig(); + clientConfig.register(MultiPartFeature.class); + clientConfig.register(json); + clientConfig.register(JacksonFeature.class); + clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); + // turn off compliance validation to be able to send payloads with DELETE calls + clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + if (debugging) { + clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */)); + clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY); + // Set logger to ALL + java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); + } else { + // suppress warnings for payloads with DELETE calls: + java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); + } + performAdditionalClientConfiguration(clientConfig); + return ClientBuilder.newClient(clientConfig); + } + + protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { + // No-op extension point + } + + protected Map> buildResponseHeaders(Response response) { + Map> responseHeaders = new HashMap>(); + for (Entry> entry: response.getHeaders().entrySet()) { + List values = entry.getValue(); + List headers = new ArrayList(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param method HTTP method (e.g. POST) + * @param uri HTTP URI + */ + protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + continue; + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiException.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..3612265bc619 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,94 @@ +/* + * 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; + +import java.util.Map; +import java.util.List; + +/** + * API Exception + */ + +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiResponse.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..5f3daf26600c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,74 @@ +/* + * 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; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + private final int statusCode; + private final Map> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + * Get the status code + * + * @return status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + * Get the headers + * + * @return map of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + * Get the data + * + * @return data + */ + public T getData() { + return data; + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Configuration.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..acbecda489dd --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,39 @@ +/* + * 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; + + +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..fd834ef6b4a0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,49 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +import java.text.DateFormat; + +import javax.ws.rs.ext.ContextResolver; + + +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + mapper.registerModule(new JavaTimeModule()); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..ae89aa614543 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,61 @@ +/* + * 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; + + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..9509fd089812 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,32 @@ +/* + * 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; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..a1107a8690e4 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A describtion of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerVariable.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..c2f13e216662 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,23 @@ +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..747a23f5bf23 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,83 @@ +/* + * 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; + +import java.util.Collection; +import java.util.Iterator; + + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..4d808ec6f5f1 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,115 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class AnotherFakeApi { + private ApiClient apiClient; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client call123testSpecialTags(Client client) throws ApiException { + return call123testSpecialTagsWithHttpInfo(client).getData(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse call123testSpecialTagsWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); + } + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..eb269e49f800 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,108 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.InlineResponseDefault; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class DefaultApi { + private ApiClient apiClient; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + * @return InlineResponseDefault + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 response -
+ */ + public InlineResponseDefault fooGet() throws ApiException { + return fooGetWithHttpInfo().getData(); + } + + /** + * + * + * @return ApiResponse<InlineResponseDefault> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..8f9179fa787b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,1257 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +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.OuterEnum; +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeApi { + private ApiClient apiClient; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Health check endpoint + * + * @return HealthCheckResult + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public HealthCheckResult fakeHealthGet() throws ApiException { + return fakeHealthGetWithHttpInfo().getData(); + } + + /** + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 The instance started successfully -
+ */ + public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeHealthGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
+ */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) throws ApiException { + return fakeOuterCompositeSerializeWithHttpInfo(outerComposite).getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
+ */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite) throws ApiException { + Object localVarPostBody = outerComposite; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + return fakeOuterNumberSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
+ */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public String fakeOuterStringSerialize(String body) throws ApiException { + return fakeOuterStringSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
+ */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Array of Enums + * + * @return List<OuterEnum> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public List getArrayOfEnums() throws ApiException { + return getArrayOfEnumsWithHttpInfo().getData(); + } + + /** + * Array of Enums + * + * @return ApiResponse<List<OuterEnum>> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Got named array of enums -
+ */ + public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/array-of-enums"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("FakeApi.getArrayOfEnums", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) throws ApiException { + Object localVarPostBody = fileSchemaTestClass; + + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * + * + * @param query (required) + * @param user (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testBodyWithQueryParams(String query, User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); + } + + /** + * + * + * @param query (required) + * @param user (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClientModel(Client client) throws ApiException { + return testClientModelWithHttpInfo(client).getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClientModelWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional, default to 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (integer != null) + localVarFormParams.put("integer", integer); +if (int32 != null) + localVarFormParams.put("int32", int32); +if (int64 != null) + localVarFormParams.put("int64", int64); +if (number != null) + localVarFormParams.put("number", number); +if (_float != null) + localVarFormParams.put("float", _float); +if (_double != null) + localVarFormParams.put("double", _double); +if (string != null) + localVarFormParams.put("string", string); +if (patternWithoutDelimiter != null) + localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); +if (_byte != null) + localVarFormParams.put("byte", _byte); +if (binary != null) + localVarFormParams.put("binary", binary); +if (date != null) + localVarFormParams.put("date", date); +if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); +if (password != null) + localVarFormParams.put("password", password); +if (paramCallback != null) + localVarFormParams.put("callback", paramCallback); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + + return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @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 enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { + testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<>()) + * @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 enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
+ */ + public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); + + if (enumHeaderStringArray != null) + localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); +if (enumHeaderString != null) + localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + + + if (enumFormStringArray != null) + localVarFormParams.put("enum_form_string_array", enumFormStringArray); +if (enumFormString != null) + localVarFormParams.put("enum_form_string", enumFormString); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + +private ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group)); + + if (requiredBooleanGroup != null) + localVarHeaderParams.put("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); +if (booleanGroup != null) + localVarHeaderParams.put("boolean_group", apiClient.parameterToString(booleanGroup)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "bearer_test" }; + + return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + + public class APItestGroupParametersRequest { + private Integer requiredStringGroup; + private Boolean requiredBooleanGroup; + private Long requiredInt64Group; + private Integer stringGroup; + private Boolean booleanGroup; + private Long int64Group; + + private APItestGroupParametersRequest() { + } + + /** + * Set requiredStringGroup + * @param requiredStringGroup Required String in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredStringGroup(Integer requiredStringGroup) { + this.requiredStringGroup = requiredStringGroup; + return this; + } + + /** + * Set requiredBooleanGroup + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredBooleanGroup(Boolean requiredBooleanGroup) { + this.requiredBooleanGroup = requiredBooleanGroup; + return this; + } + + /** + * Set requiredInt64Group + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredInt64Group(Long requiredInt64Group) { + this.requiredInt64Group = requiredInt64Group; + return this; + } + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(Long int64Group) { + this.int64Group = int64Group; + return this; + } + + /** + * Execute testGroupParameters request + + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
+ + */ + + public void execute() throws ApiException { + this.executeWithHttpInfo().getData(); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
+ + */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @return testGroupParametersRequest + * @throws ApiException if fails to make API call + + + */ + public APItestGroupParametersRequest testGroupParameters() throws ApiException { + return new APItestGroupParametersRequest(); + } + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testInlineAdditionalProperties(Map requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map requestBody) throws ApiException { + Object localVarPostBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); + } + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public void testJsonFormData(String param, String param2) throws ApiException { + testJsonFormDataWithHttpInfo(param, param2); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); + } + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (param != null) + localVarFormParams.put("param", param); +if (param2 != null) + localVarFormParams.put("param2", param2); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) throws ApiException { + testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
+ */ + public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + } + + // create path and map variables + String localVarPath = "/fake/test-query-paramters"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "pipe", pipe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ioutil", ioutil)); + localVarQueryParams.addAll(apiClient.parameterToPairs("space", "http", http)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "context", context)); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..339851556a57 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,115 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Client testClassname(Client client) throws ApiException { + return testClassnameWithHttpInfo(client).getData(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse testClassnameWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); + } + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key_query" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..d1bd8c6a5104 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,697 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class PetApi { + private ApiClient apiClient; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public void addPet(Pet pet) throws ApiException { + addPetWithHttpInfo(pet); + } + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse addPetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public void deletePet(Long petId, String apiKey) throws ApiException { + deletePetWithHttpInfo(petId, apiKey); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Invalid pet value -
+ */ + public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public List findPetsByStatus(List status) throws ApiException { + return findPetsByStatusWithHttpInfo(status).getData(); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
+ */ + public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * 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 List<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public List findPetsByTags(List tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags).getData(); + } + + /** + * 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 ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
+ * @deprecated + */ + @Deprecated + public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public Pet getPetById(Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId).getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
+ */ + public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public void updatePet(Pet pet) throws ApiException { + updatePetWithHttpInfo(pet); + } + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
+ */ + public ApiResponse updatePetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
+ */ + public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (name != null) + localVarFormParams.put("name", name); +if (status != null) + localVarFormParams.put("status", status); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); +if (file != null) + localVarFormParams.put("file", file); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); + } + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + } + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); +if (requiredFile != null) + localVarFormParams.put("requiredFile", requiredFile); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..0e29deb7564f --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,316 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.Order; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class StoreApi { + private ApiClient apiClient; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public void deleteOrder(String orderId) throws ApiException { + deleteOrderWithHttpInfo(orderId); + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public Map getInventory() throws ApiException { + return getInventoryWithHttpInfo().getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
+ */ + public ApiResponse> getInventoryWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType> localVarReturnType = new GenericType>() {}; + + return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public Order getOrderById(Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId).getData(); + } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
+ */ + public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public Order placeOrder(Order order) throws ApiException { + return placeOrderWithHttpInfo(order).getData(); + } + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
+ */ + public ApiResponse placeOrderWithHttpInfo(Order order) throws ApiException { + Object localVarPostBody = order; + + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); + } + + // create path and map variables + String localVarPath = "/store/order"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..9b6250da568d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,588 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class UserApi { + private ApiClient apiClient; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUser(User user) throws ApiException { + createUserWithHttpInfo(user); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUserWithHttpInfo(User user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); + } + + // create path and map variables + String localVarPath = "/user"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithArrayInput(List user) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithArrayInputWithHttpInfo(List user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void createUsersWithListInput(List user) throws ApiException { + createUsersWithListInputWithHttpInfo(user); + } + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse createUsersWithListInputWithHttpInfo(List user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithList"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public void deleteUser(String username) throws ApiException { + deleteUserWithHttpInfo(username); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public User getUserByName(String username) throws ApiException { + return getUserByNameWithHttpInfo(username).getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
+ */ + public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
+ */ + public String loginUser(String username, String password) throws ApiException { + return loginUserWithHttpInfo(username, password).getData(); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
+ */ + public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + // create path and map variables + String localVarPath = "/user/login"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public void logoutUser() throws ApiException { + logoutUserWithHttpInfo(); + } + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
+ */ + public ApiResponse logoutUserWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public void updateUser(String username, User user) throws ApiException { + updateUserWithHttpInfo(username, user); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
+ */ + public ApiResponse updateUserWithHttpInfo(String username, User user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..c1b2e4840702 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,79 @@ +/* + * 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.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..579b5e0d6d53 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,33 @@ +/* + * 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.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..e6f95e585639 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -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.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.util.Base64; +import java.nio.charset.StandardCharsets; + +import java.net.URI; +import java.util.Map; +import java.util.List; + + + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..1b46b4c6839f --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -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.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + + +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { + if(bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java new file mode 100644 index 000000000000..5f0e4dba3509 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java @@ -0,0 +1,265 @@ +/* + * 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.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.Key; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.List; +import java.security.spec.AlgorithmParameterSpec; +import java.security.InvalidKeyException; + +import org.tomitribe.auth.signatures.Algorithm; +import org.tomitribe.auth.signatures.Signer; +import org.tomitribe.auth.signatures.Signature; +import org.tomitribe.auth.signatures.SigningAlgorithm; + +/** + * A Configuration object for the HTTP message signature security scheme. + */ +public class HttpSignatureAuth implements Authentication { + + private Signer signer; + + // An opaque string that the server can use to look up the component they need to validate the signature. + private String keyId; + + // The HTTP signature algorithm. + private SigningAlgorithm signingAlgorithm; + + // The HTTP cryptographic algorithm. + private Algorithm algorithm; + + // The cryptographic parameters. + private AlgorithmParameterSpec parameterSpec; + + // The list of HTTP headers that should be included in the HTTP signature. + private List headers; + + // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + private String digestAlgorithm; + + /** + * Construct a new HTTP signature auth configuration object. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + * @param signingAlgorithm The signature algorithm. + * @param algorithm The cryptographic algorithm. + * @param digestAlgorithm The digest algorithm. + * @param headers The list of HTTP headers that should be included in the HTTP signature. + */ + public HttpSignatureAuth(String keyId, + SigningAlgorithm signingAlgorithm, + Algorithm algorithm, + String digestAlgorithm, + AlgorithmParameterSpec parameterSpec, + List headers) { + this.keyId = keyId; + this.signingAlgorithm = signingAlgorithm; + this.algorithm = algorithm; + this.parameterSpec = parameterSpec; + this.digestAlgorithm = digestAlgorithm; + this.headers = headers; + } + + /** + * Returns the opaque string that the server can use to look up the component they need to validate the signature. + * + * @return The keyId. + */ + public String getKeyId() { + return keyId; + } + + /** + * Set the HTTP signature key id. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + */ + public void setKeyId(String keyId) { + this.keyId = keyId; + } + + /** + * Returns the HTTP signature algorithm which is used to sign HTTP requests. + */ + public SigningAlgorithm getSigningAlgorithm() { + return signingAlgorithm; + } + + /** + * Sets the HTTP signature algorithm which is used to sign HTTP requests. + * + * @param signingAlgorithm The HTTP signature algorithm. + */ + public void setSigningAlgorithm(SigningAlgorithm signingAlgorithm) { + this.signingAlgorithm = signingAlgorithm; + } + + /** + * Returns the HTTP cryptographic algorithm which is used to sign HTTP requests. + */ + public Algorithm getAlgorithm() { + return algorithm; + } + + /** + * Sets the HTTP cryptographic algorithm which is used to sign HTTP requests. + * + * @param algorithm The HTTP signature algorithm. + */ + public void setAlgorithm(Algorithm algorithm) { + this.algorithm = algorithm; + } + + /** + * Returns the cryptographic parameters which are used to sign HTTP requests. + */ + public AlgorithmParameterSpec getAlgorithmParameterSpec() { + return parameterSpec; + } + + /** + * Sets the cryptographic parameters which are used to sign HTTP requests. + * + * @param parameterSpec The cryptographic parameters. + */ + public void setAlgorithmParameterSpec(AlgorithmParameterSpec parameterSpec) { + this.parameterSpec = parameterSpec; + } + + /** + * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * @see java.security.MessageDigest + */ + public String getDigestAlgorithm() { + return digestAlgorithm; + } + + /** + * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * The exact list of supported digest algorithms depends on the installed security providers. + * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". + * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. + * By default, "SHA-256" is used. + * + * @param digestAlgorithm The digest algorithm. + * + * @see java.security.MessageDigest + */ + public void setDigestAlgorithm(String digestAlgorithm) { + this.digestAlgorithm = digestAlgorithm; + } + + /** + * Returns the list of HTTP headers that should be included in the HTTP signature. + */ + public List getHeaders() { + return headers; + } + + /** + * Sets the list of HTTP headers that should be included in the HTTP signature. + * + * @param headers The HTTP headers. + */ + public void setHeaders(List headers) { + this.headers = headers; + } + + /** + * Returns the signer instance used to sign HTTP messages. + * + * @return the signer instance. + */ + public Signer getSigner() { + return signer; + } + + /** + * Sets the signer instance used to sign HTTP messages. + * + * @param signer The signer instance to set. + */ + public void setSigner(Signer signer) { + this.signer = signer; + } + + /** + * Set the private key used to sign HTTP requests using the HTTP signature scheme. + * + * @param key The private key. + * + * @throws InvalidKeyException Unable to parse the key, or the security provider for this key + * is not installed. + */ + public void setPrivateKey(Key key) throws InvalidKeyException, ApiException { + if (key == null) { + throw new ApiException("Private key (java.security.Key) cannot be null"); + } + signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers)); + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + try { + if (headers.contains("host")) { + headerParams.put("host", uri.getHost()); + } + + if (headers.contains("date")) { + headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); + } + + if (headers.contains("digest")) { + headerParams.put("digest", + this.digestAlgorithm + "=" + + new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); + } + + if (signer == null) { + throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); + } + + // construct the path with the URL query string + String path = uri.getPath(); + + List urlQueries = new ArrayList(); + for (Pair queryParam : queryParams) { + urlQueries.add(queryParam.getName() + "=" + URLEncoder.encode(queryParam.getValue(), "utf8").replaceAll("\\+", "%20")); + } + + if (!urlQueries.isEmpty()) { + path = path + "?" + String.join("&", urlQueries); + } + + headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); + } catch (Exception ex) { + throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); + } + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..5751094fa1db --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,183 @@ +/* + * 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.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.exceptions.OAuthException; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; + +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.logging.Logger; + + +public class OAuth implements Authentication { + private static final Logger log = Logger.getLogger(OAuth.class.getName()); + + private String tokenUrl; + private String absoluteTokenUrl; + private OAuthFlow flow = OAuthFlow.application; + private OAuth20Service service; + private DefaultApi20 authApi; + private String scope; + private String username; + private String password; + private String code; + private volatile OAuth2AccessToken accessToken; + + public OAuth(String basePath, String tokenUrl) { + this.tokenUrl = tokenUrl; + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + authApi = new DefaultApi20() { + @Override + public String getAccessTokenEndpoint() { + return absoluteTokenUrl; + } + + @Override + protected String getAuthorizationBaseUrl() { + throw new UnsupportedOperationException("Shouldn't get there !"); + } + }; + } + + private static String createAbsoluteTokenUrl(String basePath, String tokenUrl) { + if (!URI.create(tokenUrl).isAbsolute()) { + try { + return UriBuilder.fromPath(basePath).path(tokenUrl).build().toURL().toString(); + } catch (MalformedURLException e) { + log.log(Level.SEVERE, "Couldn't create absolute token URL", e); + } + } + return tokenUrl; + } + + @Override + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams, + String payload, + String method, + URI uri) + throws ApiException { + + if (accessToken == null) { + obtainAccessToken(null); + } + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken.getAccessToken()); + } + } + + public OAuth2AccessToken renewAccessToken() throws ApiException { + String refreshToken = null; + if (accessToken != null) { + refreshToken = accessToken.getRefreshToken(); + accessToken = null; + } + return obtainAccessToken(refreshToken); + } + + public synchronized OAuth2AccessToken obtainAccessToken(String refreshToken) throws ApiException { + if (service == null) { + return null; + } + try { + if (refreshToken != null) { + return service.refreshAccessToken(refreshToken); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + log.log(Level.FINE, "Refreshing the access token using the refresh token failed", e); + } + try { + switch (flow) { + case password: + if (username != null && password != null) { + accessToken = service.getAccessTokenPasswordGrant(username, password, scope); + } + break; + case accessCode: + if (code != null) { + accessToken = service.getAccessToken(code); + code = null; + } + break; + case application: + accessToken = service.getAccessTokenClientCredentialsGrant(scope); + } + } catch (OAuthException | InterruptedException | ExecutionException | IOException e) { + throw new ApiException(e); + } + return accessToken; + } + + public OAuth2AccessToken getAccessToken() { + return accessToken; + } + + public OAuth setAccessToken(OAuth2AccessToken accessToken) { + this.accessToken = accessToken; + return this; + } + + public OAuth setAccessToken(String accessToken) { + this.accessToken = new OAuth2AccessToken(accessToken); + return this; + } + + public OAuth setScope(String scope) { + this.scope = scope; + return this; + } + + public OAuth setCredentials(String clientId, String clientSecret) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .build(authApi); + return this; + } + + public OAuth usePasswordFlow(String username, String password) { + this.flow = OAuthFlow.password; + this.username = username; + this.password = password; + return this; + } + + public OAuth useAuthorizationCodeFlow(String code) { + this.flow = OAuthFlow.accessCode; + this.code = code; + return this; + } + + public OAuth setFlow(OAuthFlow flow) { + this.flow = flow; + return this; + } + + public void setBasePath(String basePath) { + this.absoluteTokenUrl = createAbsoluteTokenUrl(basePath, tokenUrl); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..b2d11ff0c4f0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,18 @@ +/* + * 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.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..892694344461 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,127 @@ +/* + * 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 org.openapitools.client.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ + +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /*** + * Get the list of schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map getSchemas(); + + /*** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /*** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /*** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /*** + * Is nullalble + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..624b19e97f3d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,367 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesClass + */ +@JsonPropertyOrder({ + AdditionalPropertiesClass.JSON_PROPERTY_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 +}) + +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + private Map mapProperty = null; + + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + private Map> mapOfMapProperty = null; + + public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + private JsonNullable anytype1 = JsonNullable.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 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 mapWithUndeclaredPropertiesString = null; + + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapProperty() { + return mapProperty; + } + + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + public AdditionalPropertiesClass anytype1(Object anytype1) { + this.anytype1 = JsonNullable.of(anytype1); + + return this; + } + + /** + * Get anytype1 + * @return anytype1 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Object getAnytype1() { + return anytype1.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnytype1_JsonNullable() { + return anytype1; + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + public void setAnytype1_JsonNullable(JsonNullable anytype1) { + this.anytype1 = anytype1; + } + + public void setAnytype1(Object anytype1) { + this.anytype1 = JsonNullable.of(anytype1); + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) { + + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; + return this; + } + + /** + * Get mapWithUndeclaredPropertiesAnytype1 + * @return mapWithUndeclaredPropertiesAnytype1 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype1() { + return mapWithUndeclaredPropertiesAnytype1; + } + + + 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMapWithUndeclaredPropertiesAnytype2() { + return mapWithUndeclaredPropertiesAnytype2; + } + + + public void setMapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(Map 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesAnytype3() { + return mapWithUndeclaredPropertiesAnytype3; + } + + + public void setMapWithUndeclaredPropertiesAnytype3(Map 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's an empty map. + * @return emptyMap + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "an object with no declared properties and no undeclared properties, hence it's an empty map.") + @JsonProperty(JSON_PROPERTY_EMPTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getEmptyMap() { + return emptyMap; + } + + + public void setEmptyMap(Object emptyMap) { + this.emptyMap = emptyMap; + } + + + public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(Map 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapWithUndeclaredPropertiesString() { + return mapWithUndeclaredPropertiesString; + } + + + public void setMapWithUndeclaredPropertiesString(Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty) && + Objects.equals(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); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty, anytype1, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + 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(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..307baecc9634 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java @@ -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.util.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Cat; +import org.openapitools.client.model.Dog; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), +}) + +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + private String color = "red"; + + + public Animal className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + public Animal color(String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java new file mode 100644 index 000000000000..e74a41ea1991 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Apple + */ +@JsonPropertyOrder({ + Apple.JSON_PROPERTY_CULTIVAR, + Apple.JSON_PROPERTY_ORIGIN +}) + +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 cultivar(String cultivar) { + + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCultivar() { + return cultivar; + } + + + 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ORIGIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getOrigin() { + return origin; + } + + + public void setOrigin(String origin) { + this.origin = origin; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java new file mode 100644 index 000000000000..90a3207fc704 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java @@ -0,0 +1,132 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppleReq + */ +@JsonPropertyOrder({ + AppleReq.JSON_PROPERTY_CULTIVAR, + AppleReq.JSON_PROPERTY_MEALY +}) + +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 cultivar(String cultivar) { + + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getCultivar() { + return cultivar; + } + + + 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MEALY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMealy() { + return mealy; + } + + + public void setMealy(Boolean mealy) { + this.mealy = mealy; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..28d19953c345 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,113 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) + +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + private List> arrayArrayNumber = null; + + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..5eeac9d8ac5d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,113 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) + +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + private List arrayNumber = null; + + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayNumber() { + return arrayNumber; + } + + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..df57098053eb --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,191 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayTest + */ +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) + +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + private List arrayOfString = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + private List> arrayArrayOfInteger = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + private List> arrayArrayOfModel = null; + + + public ArrayTest arrayOfString(List arrayOfString) { + + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayOfString() { + return arrayOfString; + } + + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java new file mode 100644 index 000000000000..bb8fd654e455 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java @@ -0,0 +1,103 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Banana + */ +@JsonPropertyOrder({ + Banana.JSON_PROPERTY_LENGTH_CM +}) + +public class Banana { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + private BigDecimal lengthCm; + + + public Banana lengthCm(BigDecimal lengthCm) { + + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + + public void setLengthCm(BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java new file mode 100644 index 000000000000..719d1034095d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BananaReq + */ +@JsonPropertyOrder({ + BananaReq.JSON_PROPERTY_LENGTH_CM, + BananaReq.JSON_PROPERTY_SWEET +}) + +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 lengthCm(BigDecimal lengthCm) { + + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + + 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SWEET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSweet() { + return sweet; + } + + + public void setSweet(Boolean sweet) { + this.sweet = sweet; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java new file mode 100644 index 000000000000..d13bc304b2da --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java @@ -0,0 +1,101 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BasquePig + */ +@JsonPropertyOrder({ + BasquePig.JSON_PROPERTY_CLASS_NAME +}) + +public class BasquePig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + + public BasquePig className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..033e97881105 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,257 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Capitalization + */ +@JsonPropertyOrder({ + Capitalization.JSON_PROPERTY_SMALL_CAMEL, + Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, + Capitalization.JSON_PROPERTY_SMALL_SNAKE, + Capitalization.JSON_PROPERTY_CAPITAL_SNAKE, + Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, + Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E +}) + +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + private String ATT_NAME; + + + public Capitalization smallCamel(String smallCamel) { + + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallCamel() { + return smallCamel; + } + + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(String capitalCamel) { + + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalCamel() { + return capitalCamel; + } + + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(String smallSnake) { + + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallSnake() { + return smallSnake; + } + + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(String capitalSnake) { + + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalSnake() { + return capitalSnake; + } + + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(String ATT_NAME) { + + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Name of the pet ") + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getATTNAME() { + return ATT_NAME; + } + + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..05e080b32291 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,112 @@ +/* + * 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.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.CatAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) +@JsonSubTypes({ +}) + +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + + public Cat declawed(Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java new file mode 100644 index 000000000000..3e7b991436aa --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -0,0 +1,102 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * CatAllOf + */ +@JsonPropertyOrder({ + CatAllOf.JSON_PROPERTY_DECLAWED +}) + +public class CatAllOf { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + + public CatAllOf declawed(Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatAllOf catAllOf = (CatAllOf) o; + return Objects.equals(this.declawed, catAllOf.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatAllOf {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..868ba8750742 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,132 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) + +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name = "default-name"; + + + public Category id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Category name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java new file mode 100644 index 000000000000..272be70fc2a6 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java @@ -0,0 +1,112 @@ +/* + * 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.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCatAllOf; +import org.openapitools.client.model.ParentPet; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ChildCat + */ +@JsonPropertyOrder({ + ChildCat.JSON_PROPERTY_NAME +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ +}) + +public class ChildCat extends ParentPet { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public ChildCat name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.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) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, 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("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java new file mode 100644 index 000000000000..aa495e74cd43 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java @@ -0,0 +1,102 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ChildCatAllOf + */ +@JsonPropertyOrder({ + ChildCatAllOf.JSON_PROPERTY_NAME +}) + +public class ChildCatAllOf { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public ChildCatAllOf name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.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); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildCatAllOf {\n"); + sb.append(" name: ").append(toIndentedString(name)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..4de7664b26a7 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,103 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) + +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + private String propertyClass; + + + public ClassModel propertyClass(String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..02b0aac2247a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,102 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) + +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + private String client; + + + public Client client(String client) { + + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClient() { + return client; + } + + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java new file mode 100644 index 000000000000..7e99e3ec4bf6 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ComplexQuadrilateral + */ +@JsonPropertyOrder({ + ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) + +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 shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public ComplexQuadrilateral quadrilateralType(String quadrilateralType) { + + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java new file mode 100644 index 000000000000..cf4907374211 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java @@ -0,0 +1,101 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * DanishPig + */ +@JsonPropertyOrder({ + DanishPig.JSON_PROPERTY_CLASS_NAME +}) + +public class DanishPig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + + public DanishPig className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..f56658043689 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,112 @@ +/* + * 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.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.DogAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) +@JsonSubTypes({ +}) + +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + + public Dog breed(String breed) { + + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java new file mode 100644 index 000000000000..dd42595cf202 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -0,0 +1,102 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * DogAllOf + */ +@JsonPropertyOrder({ + DogAllOf.JSON_PROPERTY_BREED +}) + +public class DogAllOf { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + + public DogAllOf breed(String breed) { + + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DogAllOf dogAllOf = (DogAllOf) o; + return Objects.equals(this.breed, dogAllOf.breed); + } + + @Override + public int hashCode() { + return Objects.hash(breed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DogAllOf {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java new file mode 100644 index 000000000000..f92f7d3f461d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java @@ -0,0 +1,226 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +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 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 +}) + +public class Drawing extends HashMap { + public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape"; + private Shape mainShape = null; + + public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull"; + private ShapeOrNull shapeOrNull = null; + + public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape"; + private JsonNullable nullableShape = JsonNullable.of(null); + + public static final String JSON_PROPERTY_SHAPES = "shapes"; + private List shapes = null; + + + public Drawing mainShape(Shape mainShape) { + + this.mainShape = mainShape; + return this; + } + + /** + * Get mainShape + * @return mainShape + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAIN_SHAPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Shape getMainShape() { + return mainShape; + } + + + 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ShapeOrNull getShapeOrNull() { + return shapeOrNull; + } + + + public void setShapeOrNull(ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + } + + + public Drawing nullableShape(NullableShape nullableShape) { + this.nullableShape = JsonNullable.of(nullableShape); + + return this; + } + + /** + * Get nullableShape + * @return nullableShape + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public NullableShape getNullableShape() { + return nullableShape.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableShape_JsonNullable() { + return nullableShape; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + public void setNullableShape_JsonNullable(JsonNullable nullableShape) { + this.nullableShape = nullableShape; + } + + public void setNullableShape(NullableShape nullableShape) { + this.nullableShape = JsonNullable.of(nullableShape); + } + + + public Drawing shapes(List 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHAPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getShapes() { + return shapes; + } + + + public void setShapes(List shapes) { + this.shapes = shapes; + } + + + @Override + public boolean equals(java.lang.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) && + Objects.equals(this.nullableShape, drawing.nullableShape) && + Objects.equals(this.shapes, drawing.shapes) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(mainShape, shapeOrNull, nullableShape, shapes, super.hashCode()); + } + + + @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("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..86526adb3fa7 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,213 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; + private List arrayEnum = null; + + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(List arrayEnum) { + + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayEnum() { + return arrayEnum; + } + + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..e9102d974276 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,60 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..cf6d574a5f97 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,479 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EnumTest + */ +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE +}) + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @JsonValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_NUMBER = "enum_number"; + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + private JsonNullable outerEnum = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + + public EnumTest enumString(EnumStringEnum enumString) { + + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumStringEnum getEnumString() { + return enumString; + } + + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public OuterEnum getOuterEnum() { + return outerEnum.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getOuterEnum_JsonNullable() { + return outerEnum; + } + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + public void setOuterEnum_JsonNullable(JsonNullable outerEnum) { + this.outerEnum = outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); + } + + + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + 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(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java new file mode 100644 index 000000000000..6e93c9efbf8d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EquilateralTriangle + */ +@JsonPropertyOrder({ + EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE, + EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) + +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 shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public EquilateralTriangle triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..cfd62fbce628 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,143 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * FileSchemaTestClass + */ +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) + +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + private java.io.File file; + + public static final String JSON_PROPERTY_FILES = "files"; + private List files = null; + + + public FileSchemaTestClass file(java.io.File file) { + + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public java.io.File getFile() { + return file; + } + + + public void setFile(java.io.File file) { + this.file = file; + } + + + public FileSchemaTestClass files(List files) { + + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getFiles() { + return files; + } + + + public void setFiles(List files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java new file mode 100644 index 000000000000..e531ce87dbf2 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java @@ -0,0 +1,102 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Foo + */ +@JsonPropertyOrder({ + Foo.JSON_PROPERTY_BAR +}) + +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar = "bar"; + + + public Foo bar(String bar) { + + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + public void setBar(String bar) { + this.bar = bar; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..f66ee0018894 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,547 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * FormatTest + */ +@JsonPropertyOrder({ + FormatTest.JSON_PROPERTY_INTEGER, + FormatTest.JSON_PROPERTY_INT32, + FormatTest.JSON_PROPERTY_INT64, + FormatTest.JSON_PROPERTY_NUMBER, + FormatTest.JSON_PROPERTY_FLOAT, + FormatTest.JSON_PROPERTY_DOUBLE, + FormatTest.JSON_PROPERTY_STRING, + FormatTest.JSON_PROPERTY_BYTE, + FormatTest.JSON_PROPERTY_BINARY, + FormatTest.JSON_PROPERTY_DATE, + FormatTest.JSON_PROPERTY_DATE_TIME, + FormatTest.JSON_PROPERTY_UUID, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER +}) + +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + private String patternWithDigits; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + private String patternWithDigitsAndDelimiter; + + + public FormatTest integer(Integer integer) { + + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + + public void setInteger(Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(Integer int32) { + + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(Long int64) { + + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + + public void setInt64(Long int64) { + this.int64 = int64; + } + + + public FormatTest number(BigDecimal number) { + + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + + public void setNumber(BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(Float _float) { + + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + + public void setFloat(Float _float) { + this._float = _float; + } + + + public FormatTest _double(Double _double) { + + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getDouble() { + return _double; + } + + + public void setDouble(Double _double) { + this._double = _double; + } + + + public FormatTest string(String string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + + public void setString(String string) { + this.string = string; + } + + + public FormatTest _byte(byte[] _byte) { + + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(File binary) { + + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + + public void setBinary(File binary) { + this.binary = binary; + } + + + public FormatTest date(LocalDate date) { + + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @ApiModelProperty(example = "Sun Feb 02 08:00:00 HKT 2020", required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2007-12-03T10:15:30+01:00", value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest password(String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public FormatTest patternWithDigits(String patternWithDigits) { + + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigits() { + return patternWithDigits; + } + + + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + * @return patternWithDigitsAndDelimiter + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Fruit.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..a9eeee525b6e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Fruit.java @@ -0,0 +1,141 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Fruit.FruitDeserializer.class) +public class Fruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Fruit.class.getName()); + + public static class FruitDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize Apple + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map 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", new GenericType() { + }); + schemas.put("Banana", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Fruit.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Apple) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Banana) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FruitReq.java new file mode 100644 index 000000000000..2a46202a7ed3 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FruitReq.java @@ -0,0 +1,141 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=FruitReq.FruitReqDeserializer.class) +public class FruitReq extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FruitReq.class.getName()); + + public static class FruitReqDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize AppleReq + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(AppleReq.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BananaReq.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public FruitReq() { + super("oneOf", Boolean.TRUE); + } + + public FruitReq(AppleReq o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public FruitReq(BananaReq o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("AppleReq", new GenericType() { + }); + schemas.put("BananaReq", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return FruitReq.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof AppleReq) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof BananaReq) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GmFruit.java new file mode 100644 index 000000000000..6dd57e7c3a55 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GmFruit.java @@ -0,0 +1,134 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=GmFruit.GmFruitDeserializer.class) +public class GmFruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GmFruit.class.getName()); + + public static class GmFruitDeserializer extends StdDeserializer { + 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; + // deserialzie 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); + } + + // deserialzie 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")); + } + } + + // store a list of schema names defined in anyOf + public final static Map schemas = new HashMap(); + + 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", new GenericType() { + }); + schemas.put("Banana", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return GmFruit.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Apple) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Banana) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java new file mode 100644 index 000000000000..18f7c9f55be0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -0,0 +1,111 @@ +/* + * 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.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.ParentPet; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * GrandparentAnimal + */ +@JsonPropertyOrder({ + GrandparentAnimal.JSON_PROPERTY_PET_TYPE +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_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 petType(String petType) { + + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPetType() { + return petType; + } + + + public void setPetType(String petType) { + this.petType = petType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..0a3f0d464360 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,115 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) + +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + private String foo; + + + /** + * Get bar + * @return bar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + /** + * Get foo + * @return foo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FOO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFoo() { + return foo; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..efb77061df17 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -0,0 +1,116 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@ApiModel(description = "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) + +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + private JsonNullable nullableMessage = JsonNullable.undefined(); + + + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getNullableMessage() { + return nullableMessage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableMessage_JsonNullable() { + return nullableMessage; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + public void setNullableMessage_JsonNullable(JsonNullable nullableMessage) { + this.nullableMessage = nullableMessage; + } + + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject.java new file mode 100644 index 000000000000..bb0804c5240e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject + */ +@JsonPropertyOrder({ + InlineObject.JSON_PROPERTY_NAME, + InlineObject.JSON_PROPERTY_STATUS +}) + +public class InlineObject { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + + public InlineObject name(String name) { + + this.name = name; + return this; + } + + /** + * Updated name of the pet + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Updated name of the pet") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public InlineObject status(String status) { + + this.status = status; + return this; + } + + /** + * Updated status of the pet + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Updated status of the pet") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject inlineObject = (InlineObject) o; + return Objects.equals(this.name, inlineObject.name) && + Objects.equals(this.status, inlineObject.status); + } + + @Override + public int hashCode() { + return Objects.hash(name, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject1.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject1.java new file mode 100644 index 000000000000..99b98f4c848e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject1.java @@ -0,0 +1,134 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject1 + */ +@JsonPropertyOrder({ + InlineObject1.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject1.JSON_PROPERTY_FILE +}) + +public class InlineObject1 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_FILE = "file"; + private File file; + + + public InlineObject1 additionalMetadata(String additionalMetadata) { + + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + + public InlineObject1 file(File file) { + + this.file = file; + return this; + } + + /** + * file to upload + * @return file + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "file to upload") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getFile() { + return file; + } + + + public void setFile(File file) { + this.file = file; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject1 inlineObject1 = (InlineObject1) o; + return Objects.equals(this.additionalMetadata, inlineObject1.additionalMetadata) && + Objects.equals(this.file, inlineObject1.file); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, file); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject1 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject2.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject2.java new file mode 100644 index 000000000000..468545bb3427 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject2.java @@ -0,0 +1,215 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject2 + */ +@JsonPropertyOrder({ + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING_ARRAY, + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING +}) + +public class InlineObject2 { + /** + * Gets or Sets enumFormStringArray + */ + public enum EnumFormStringArrayEnum { + GREATER_THAN(">"), + + DOLLAR("$"); + + private String value; + + EnumFormStringArrayEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringArrayEnum fromValue(String value) { + for (EnumFormStringArrayEnum b : EnumFormStringArrayEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING_ARRAY = "enum_form_string_array"; + private List enumFormStringArray = null; + + /** + * Form parameter enum test (string) + */ + public enum EnumFormStringEnum { + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumFormStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringEnum fromValue(String value) { + for (EnumFormStringEnum b : EnumFormStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING = "enum_form_string"; + private EnumFormStringEnum enumFormString = EnumFormStringEnum._EFG; + + + public InlineObject2 enumFormStringArray(List enumFormStringArray) { + + this.enumFormStringArray = enumFormStringArray; + return this; + } + + public InlineObject2 addEnumFormStringArrayItem(EnumFormStringArrayEnum enumFormStringArrayItem) { + if (this.enumFormStringArray == null) { + this.enumFormStringArray = new ArrayList<>(); + } + this.enumFormStringArray.add(enumFormStringArrayItem); + return this; + } + + /** + * Form parameter enum test (string array) + * @return enumFormStringArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string array)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getEnumFormStringArray() { + return enumFormStringArray; + } + + + public void setEnumFormStringArray(List enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + } + + + public InlineObject2 enumFormString(EnumFormStringEnum enumFormString) { + + this.enumFormString = enumFormString; + return this; + } + + /** + * Form parameter enum test (string) + * @return enumFormString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumFormStringEnum getEnumFormString() { + return enumFormString; + } + + + public void setEnumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject2 inlineObject2 = (InlineObject2) o; + return Objects.equals(this.enumFormStringArray, inlineObject2.enumFormStringArray) && + Objects.equals(this.enumFormString, inlineObject2.enumFormString); + } + + @Override + public int hashCode() { + return Objects.hash(enumFormStringArray, enumFormString); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject2 {\n"); + sb.append(" enumFormStringArray: ").append(toIndentedString(enumFormStringArray)).append("\n"); + sb.append(" enumFormString: ").append(toIndentedString(enumFormString)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java new file mode 100644 index 000000000000..831f53670301 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java @@ -0,0 +1,514 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject3 + */ +@JsonPropertyOrder({ + InlineObject3.JSON_PROPERTY_INTEGER, + InlineObject3.JSON_PROPERTY_INT32, + InlineObject3.JSON_PROPERTY_INT64, + InlineObject3.JSON_PROPERTY_NUMBER, + InlineObject3.JSON_PROPERTY_FLOAT, + InlineObject3.JSON_PROPERTY_DOUBLE, + InlineObject3.JSON_PROPERTY_STRING, + InlineObject3.JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER, + InlineObject3.JSON_PROPERTY_BYTE, + InlineObject3.JSON_PROPERTY_BINARY, + InlineObject3.JSON_PROPERTY_DATE, + InlineObject3.JSON_PROPERTY_DATE_TIME, + InlineObject3.JSON_PROPERTY_PASSWORD, + InlineObject3.JSON_PROPERTY_CALLBACK +}) + +public class InlineObject3 { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER = "pattern_without_delimiter"; + private String patternWithoutDelimiter; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime = 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_CALLBACK = "callback"; + private String callback; + + + public InlineObject3 integer(Integer integer) { + + this.integer = integer; + return this; + } + + /** + * None + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + + public void setInteger(Integer integer) { + this.integer = integer; + } + + + public InlineObject3 int32(Integer int32) { + + this.int32 = int32; + return this; + } + + /** + * None + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + public InlineObject3 int64(Long int64) { + + this.int64 = int64; + return this; + } + + /** + * None + * @return int64 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + + public void setInt64(Long int64) { + this.int64 = int64; + } + + + public InlineObject3 number(BigDecimal number) { + + this.number = number; + return this; + } + + /** + * None + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + + public void setNumber(BigDecimal number) { + this.number = number; + } + + + public InlineObject3 _float(Float _float) { + + this._float = _float; + return this; + } + + /** + * None + * maximum: 987.6 + * @return _float + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + + public void setFloat(Float _float) { + this._float = _float; + } + + + public InlineObject3 _double(Double _double) { + + this._double = _double; + return this; + } + + /** + * None + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Double getDouble() { + return _double; + } + + + public void setDouble(Double _double) { + this._double = _double; + } + + + public InlineObject3 string(String string) { + + this.string = string; + return this; + } + + /** + * None + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + + public void setString(String string) { + this.string = string; + } + + + public InlineObject3 patternWithoutDelimiter(String patternWithoutDelimiter) { + + this.patternWithoutDelimiter = patternWithoutDelimiter; + return this; + } + + /** + * None + * @return patternWithoutDelimiter + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPatternWithoutDelimiter() { + return patternWithoutDelimiter; + } + + + public void setPatternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + } + + + public InlineObject3 _byte(byte[] _byte) { + + this._byte = _byte; + return this; + } + + /** + * None + * @return _byte + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + public InlineObject3 binary(File binary) { + + this.binary = binary; + return this; + } + + /** + * None + * @return binary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + + public void setBinary(File binary) { + this.binary = binary; + } + + + public InlineObject3 date(LocalDate date) { + + this.date = date; + return this; + } + + /** + * None + * @return date + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + this.date = date; + } + + + public InlineObject3 dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * None + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-02-02T20:20:20.222220Z", value = "None") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public InlineObject3 password(String password) { + + this.password = password; + return this; + } + + /** + * None + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public InlineObject3 callback(String callback) { + + this.callback = callback; + return this; + } + + /** + * None + * @return callback + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_CALLBACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCallback() { + return callback; + } + + + public void setCallback(String callback) { + this.callback = callback; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject3 inlineObject3 = (InlineObject3) o; + return Objects.equals(this.integer, inlineObject3.integer) && + Objects.equals(this.int32, inlineObject3.int32) && + Objects.equals(this.int64, inlineObject3.int64) && + Objects.equals(this.number, inlineObject3.number) && + Objects.equals(this._float, inlineObject3._float) && + Objects.equals(this._double, inlineObject3._double) && + Objects.equals(this.string, inlineObject3.string) && + Objects.equals(this.patternWithoutDelimiter, inlineObject3.patternWithoutDelimiter) && + Arrays.equals(this._byte, inlineObject3._byte) && + Objects.equals(this.binary, inlineObject3.binary) && + Objects.equals(this.date, inlineObject3.date) && + Objects.equals(this.dateTime, inlineObject3.dateTime) && + Objects.equals(this.password, inlineObject3.password) && + Objects.equals(this.callback, inlineObject3.callback); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, patternWithoutDelimiter, Arrays.hashCode(_byte), binary, date, dateTime, password, callback); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject3 {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" patternWithoutDelimiter: ").append(toIndentedString(patternWithoutDelimiter)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" callback: ").append(toIndentedString(callback)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject4.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject4.java new file mode 100644 index 000000000000..953ca1d5b2bc --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject4.java @@ -0,0 +1,131 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject4 + */ +@JsonPropertyOrder({ + InlineObject4.JSON_PROPERTY_PARAM, + InlineObject4.JSON_PROPERTY_PARAM2 +}) + +public class InlineObject4 { + public static final String JSON_PROPERTY_PARAM = "param"; + private String param; + + public static final String JSON_PROPERTY_PARAM2 = "param2"; + private String param2; + + + public InlineObject4 param(String param) { + + this.param = param; + return this; + } + + /** + * field1 + * @return param + **/ + @ApiModelProperty(required = true, value = "field1") + @JsonProperty(JSON_PROPERTY_PARAM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getParam() { + return param; + } + + + public void setParam(String param) { + this.param = param; + } + + + public InlineObject4 param2(String param2) { + + this.param2 = param2; + return this; + } + + /** + * field2 + * @return param2 + **/ + @ApiModelProperty(required = true, value = "field2") + @JsonProperty(JSON_PROPERTY_PARAM2) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getParam2() { + return param2; + } + + + public void setParam2(String param2) { + this.param2 = param2; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject4 inlineObject4 = (InlineObject4) o; + return Objects.equals(this.param, inlineObject4.param) && + Objects.equals(this.param2, inlineObject4.param2); + } + + @Override + public int hashCode() { + return Objects.hash(param, param2); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject4 {\n"); + sb.append(" param: ").append(toIndentedString(param)).append("\n"); + sb.append(" param2: ").append(toIndentedString(param2)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject5.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject5.java new file mode 100644 index 000000000000..1b079adfcf91 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject5.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject5 + */ +@JsonPropertyOrder({ + InlineObject5.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject5.JSON_PROPERTY_REQUIRED_FILE +}) + +public class InlineObject5 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_REQUIRED_FILE = "requiredFile"; + private File requiredFile; + + + public InlineObject5 additionalMetadata(String additionalMetadata) { + + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + + public InlineObject5 requiredFile(File requiredFile) { + + this.requiredFile = requiredFile; + return this; + } + + /** + * file to upload + * @return requiredFile + **/ + @ApiModelProperty(required = true, value = "file to upload") + @JsonProperty(JSON_PROPERTY_REQUIRED_FILE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public File getRequiredFile() { + return requiredFile; + } + + + public void setRequiredFile(File requiredFile) { + this.requiredFile = requiredFile; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject5 inlineObject5 = (InlineObject5) o; + return Objects.equals(this.additionalMetadata, inlineObject5.additionalMetadata) && + Objects.equals(this.requiredFile, inlineObject5.requiredFile); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, requiredFile); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject5 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" requiredFile: ").append(toIndentedString(requiredFile)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java new file mode 100644 index 000000000000..6b90bf2a18fa --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java @@ -0,0 +1,103 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineResponseDefault + */ +@JsonPropertyOrder({ + InlineResponseDefault.JSON_PROPERTY_STRING +}) + +public class InlineResponseDefault { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; + + + public InlineResponseDefault string(Foo string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Foo getString() { + return string; + } + + + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineResponseDefault inlineResponseDefault = (InlineResponseDefault) o; + return Objects.equals(this.string, inlineResponseDefault.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineResponseDefault {\n"); + sb.append(" string: ").append(toIndentedString(string)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java new file mode 100644 index 000000000000..6282304a20bd --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IsoscelesTriangle + */ +@JsonPropertyOrder({ + IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE, + IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) + +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 shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public IsoscelesTriangle triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Mammal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Mammal.java new file mode 100644 index 000000000000..dff6e3b29c0b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Mammal.java @@ -0,0 +1,165 @@ +/* + * 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.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +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 javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Mammal.MammalDeserializer.class) +public class Mammal extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Mammal.class.getName()); + + public static class MammalDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize Pig + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map 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", new GenericType() { + }); + schemas.put("Whale", new GenericType() { + }); + schemas.put("Zebra", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Mammal.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Pig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Whale) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Zebra) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..3e72350aa8b1 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,265 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MapTest + */ +@JsonPropertyOrder({ + MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, + MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, + MapTest.JSON_PROPERTY_DIRECT_MAP, + MapTest.JSON_PROPERTY_INDIRECT_MAP +}) + +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + private Map> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string"; + private Map mapOfEnumString = null; + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + private Map directMap = null; + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + private Map indirectMap = null; + + + public MapTest mapMapOfString(Map> mapMapOfString) { + + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(Map mapOfEnumString) { + + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(Map directMap) { + + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getDirectMap() { + return directMap; + } + + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(Map indirectMap) { + + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getIndirectMap() { + return indirectMap; + } + + + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..07d314691a97 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,178 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) + +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + private Map map = null; + + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getMap() { + return map; + } + + + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..dd99468a0059 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,134 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) + +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + private String propertyClass; + + + public Model200Response name(Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getName() { + return name; + } + + + public void setName(Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..383cafdd3a5a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,164 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ModelApiResponse + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) + +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + + public ModelApiResponse code(Integer code) { + + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getCode() { + return code; + } + + + public void setCode(Integer code) { + this.code = code; + } + + + public ModelApiResponse type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ModelApiResponse message(String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..b62e13a90a0c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,103 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) + +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + private Integer _return; + + + public ModelReturn _return(Integer _return) { + + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_RETURN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getReturn() { + return _return; + } + + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..bd625c5f66f3 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,177 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) + +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + private Integer _123number; + + + public Name name(Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getName() { + return name; + } + + + public void setName(Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSnakeCase() { + return snakeCase; + } + + + + + public Name property(String property) { + + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getProperty() { + return property; + } + + + public void setProperty(String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_123NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer get123number() { + return _123number; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..6ade4828624e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,619 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * NullableClass + */ +@JsonPropertyOrder({ + NullableClass.JSON_PROPERTY_INTEGER_PROP, + NullableClass.JSON_PROPERTY_NUMBER_PROP, + NullableClass.JSON_PROPERTY_BOOLEAN_PROP, + NullableClass.JSON_PROPERTY_STRING_PROP, + NullableClass.JSON_PROPERTY_DATE_PROP, + NullableClass.JSON_PROPERTY_DATETIME_PROP, + NullableClass.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + NullableClass.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE +}) + +public class NullableClass extends HashMap { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + private JsonNullable integerProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + private JsonNullable numberProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + private JsonNullable booleanProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + private JsonNullable stringProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + private JsonNullable dateProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + private JsonNullable datetimeProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + private JsonNullable> arrayNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + private JsonNullable> arrayAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + private List arrayItemsNullable = null; + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + private JsonNullable> objectNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + private JsonNullable> objectAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + private Map objectItemsNullable = null; + + + public NullableClass integerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + + return this; + } + + /** + * Get integerProp + * @return integerProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Integer getIntegerProp() { + return integerProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIntegerProp_JsonNullable() { + return integerProp; + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + public void setIntegerProp_JsonNullable(JsonNullable integerProp) { + this.integerProp = integerProp; + } + + public void setIntegerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + } + + + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + + return this; + } + + /** + * Get numberProp + * @return numberProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public BigDecimal getNumberProp() { + return numberProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNumberProp_JsonNullable() { + return numberProp; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + public void setNumberProp_JsonNullable(JsonNullable numberProp) { + this.numberProp = numberProp; + } + + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + } + + + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + + return this; + } + + /** + * Get booleanProp + * @return booleanProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Boolean getBooleanProp() { + return booleanProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getBooleanProp_JsonNullable() { + return booleanProp; + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + public void setBooleanProp_JsonNullable(JsonNullable booleanProp) { + this.booleanProp = booleanProp; + } + + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + } + + + public NullableClass stringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + + return this; + } + + /** + * Get stringProp + * @return stringProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getStringProp() { + return stringProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getStringProp_JsonNullable() { + return stringProp; + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + public void setStringProp_JsonNullable(JsonNullable stringProp) { + this.stringProp = stringProp; + } + + public void setStringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + } + + + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + + return this; + } + + /** + * Get dateProp + * @return dateProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public LocalDate getDateProp() { + return dateProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDateProp_JsonNullable() { + return dateProp; + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + public void setDateProp_JsonNullable(JsonNullable dateProp) { + this.dateProp = dateProp; + } + + public void setDateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + } + + + public NullableClass datetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public OffsetDateTime getDatetimeProp() { + return datetimeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDatetimeProp_JsonNullable() { + return datetimeProp; + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + public void setDatetimeProp_JsonNullable(JsonNullable datetimeProp) { + this.datetimeProp = datetimeProp; + } + + public void setDatetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + } + + + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayNullableProp.get().add(arrayNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public List getArrayNullableProp() { + return arrayNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayNullableProp_JsonNullable() { + return arrayNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + public void setArrayNullableProp_JsonNullable(JsonNullable> arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + } + + + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayAndItemsNullableProp_JsonNullable() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + public void setArrayAndItemsNullableProp_JsonNullable(JsonNullable> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + } + + + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) { + this.objectNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectNullableProp.get().put(key, objectNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Map getObjectNullableProp() { + return objectNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectNullableProp_JsonNullable() { + return objectNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + public void setObjectNullableProp_JsonNullable(JsonNullable> objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + } + + + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectAndItemsNullableProp_JsonNullable() { + return objectAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + public void setObjectAndItemsNullableProp_JsonNullable(JsonNullable> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + } + + + public NullableClass objectItemsNullable(Map objectItemsNullable) { + + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + /** + * Get objectItemsNullable + * @return objectItemsNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return Objects.equals(this.integerProp, nullableClass.integerProp) && + Objects.equals(this.numberProp, nullableClass.numberProp) && + Objects.equals(this.booleanProp, nullableClass.booleanProp) && + Objects.equals(this.stringProp, nullableClass.stringProp) && + Objects.equals(this.dateProp, nullableClass.dateProp) && + Objects.equals(this.datetimeProp, nullableClass.datetimeProp) && + Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableShape.java new file mode 100644 index 000000000000..bdf4fc1dc388 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableShape.java @@ -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.util.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=NullableShape.NullableShapeDeserializer.class) +public class NullableShape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableShape.class.getName()); + + public static class NullableShapeDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize Quadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map 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", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return NullableShape.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Quadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Triangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..5ca72a169fe8 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,103 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) + +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + private BigDecimal justNumber; + + + public NumberOnly justNumber(BigDecimal justNumber) { + + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getJustNumber() { + return justNumber; + } + + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..1d1f87726a54 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,295 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Order + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) + +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + private Boolean complete = false; + + + public Order id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Order petId(Long petId) { + + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getPetId() { + return petId; + } + + + public void setPetId(Long petId) { + this.petId = petId; + } + + + public Order quantity(Integer quantity) { + + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getQuantity() { + return quantity; + } + + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(OffsetDateTime shipDate) { + + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-02-02T20:20:20.000222Z", value = "") + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getShipDate() { + return shipDate; + } + + + public void setShipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Order Status") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public Order complete(Boolean complete) { + + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getComplete() { + return complete; + } + + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..d4d9ac6ba110 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,165 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * OuterComposite + */ +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) + +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + private Boolean myBoolean; + + + public OuterComposite myNumber(BigDecimal myNumber) { + + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getMyNumber() { + return myNumber; + } + + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(String myString) { + + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMyString() { + return myString; + } + + + public void setMyString(String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(Boolean myBoolean) { + + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMyBoolean() { + return myBoolean; + } + + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..d0c0bc3c9d20 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,60 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..7f6c2c73aa24 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -0,0 +1,60 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..c747a2e6daef --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,60 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..4f5fcd1cd95f --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,60 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java new file mode 100644 index 000000000000..5b3dc1ffcaa0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java @@ -0,0 +1,81 @@ +/* + * 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.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.GrandparentAnimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParentPet + */ +@JsonPropertyOrder({ +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"), +}) + +public class ParentPet extends GrandparentAnimal { + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..2df466732f74 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,309 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Pet + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) + +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + private List photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + + public Pet id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Pet category(Category category) { + + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + + public void setCategory(Category category) { + this.category = category; + } + + + public Pet name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Pet photoUrls(List photoUrls) { + + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPhotoUrls() { + return photoUrls; + } + + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(List tags) { + + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTags() { + return tags; + } + + + public void setTags(List tags) { + this.tags = tags; + } + + + public Pet status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "pet status in the store") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pig.java new file mode 100644 index 000000000000..edf17c3ce78d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pig.java @@ -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.util.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Pig.PigDeserializer.class) +public class Pig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Pig.class.getName()); + + public static class PigDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize BasquePig + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map 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", new GenericType() { + }); + schemas.put("DanishPig", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Pig.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof BasquePig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof DanishPig) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Quadrilateral.java new file mode 100644 index 000000000000..a943d3b0db3a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Quadrilateral.java @@ -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.util.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Quadrilateral.QuadrilateralDeserializer.class) +public class Quadrilateral extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); + + public static class QuadrilateralDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize ComplexQuadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map 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", new GenericType() { + }); + schemas.put("SimpleQuadrilateral", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Quadrilateral.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof ComplexQuadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SimpleQuadrilateral) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java new file mode 100644 index 000000000000..7a586c4ca775 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -0,0 +1,101 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * QuadrilateralInterface + */ +@JsonPropertyOrder({ + QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE +}) + +public class QuadrilateralInterface { + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + private String quadrilateralType; + + + public QuadrilateralInterface quadrilateralType(String quadrilateralType) { + + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..b3e58ef3d2c5 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,124 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) + +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + private String baz; + + + /** + * Get bar + * @return bar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + public ReadOnlyFirst baz(String baz) { + + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAZ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBaz() { + return baz; + } + + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java new file mode 100644 index 000000000000..b8f6d9955d57 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ScaleneTriangle + */ +@JsonPropertyOrder({ + ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE, + ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) + +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 shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public ScaleneTriangle triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Shape.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Shape.java new file mode 100644 index 000000000000..b97481242e5d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Shape.java @@ -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.util.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Shape.ShapeDeserializer.class) +public class Shape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Shape.class.getName()); + + public static class ShapeDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize Quadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map 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", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Shape.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Quadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Triangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java new file mode 100644 index 000000000000..2b4cf2193066 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -0,0 +1,101 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ShapeInterface + */ +@JsonPropertyOrder({ + ShapeInterface.JSON_PROPERTY_SHAPE_TYPE +}) + +public class ShapeInterface { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + + public ShapeInterface shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeOrNull.java new file mode 100644 index 000000000000..6a47a10de5f0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeOrNull.java @@ -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.util.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=ShapeOrNull.ShapeOrNullDeserializer.class) +public class ShapeOrNull extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); + + public static class ShapeOrNullDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize Quadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public ShapeOrNull() { + super("oneOf", Boolean.TRUE); + } + + public ShapeOrNull(Quadrilateral o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public ShapeOrNull(Triangle o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return ShapeOrNull.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Quadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Triangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java new file mode 100644 index 000000000000..0ad65aa09dd6 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SimpleQuadrilateral + */ +@JsonPropertyOrder({ + SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) + +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 shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public SimpleQuadrilateral quadrilateralType(String quadrilateralType) { + + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..b588ef95226b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,102 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME +}) + +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + private Long $specialPropertyName; + + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..a3ecb398faa3 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,133 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) + +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public Tag id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Tag name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Triangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Triangle.java new file mode 100644 index 000000000000..0db61e7c1601 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Triangle.java @@ -0,0 +1,165 @@ +/* + * 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.Objects; +import java.util.Arrays; +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.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +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 javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Triangle.TriangleDeserializer.class) +public class Triangle extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Triangle.class.getName()); + + public static class TriangleDeserializer extends StdDeserializer { + 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(); + + int match = 0; + Object deserialized = null; + // deserialize EquilateralTriangle + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class); + 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 { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class); + 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)); + } + } + + // store a list of schema names defined in oneOf + public final static Map 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", new GenericType() { + }); + schemas.put("IsoscelesTriangle", new GenericType() { + }); + schemas.put("ScaleneTriangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Triangle.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof EquilateralTriangle) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof IsoscelesTriangle) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ScaleneTriangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java new file mode 100644 index 000000000000..5064ab5e3e6a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -0,0 +1,101 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TriangleInterface + */ +@JsonPropertyOrder({ + TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE +}) + +public class TriangleInterface { + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + + public TriangleInterface triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..570d1ace3ff4 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,476 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * User + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + 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 +}) + +public class User { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + private String phone; + + 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 objectWithNoDeclaredPropsNullable = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ANY_TYPE_PROP = "anyTypeProp"; + private JsonNullable anyTypeProp = JsonNullable.of(null); + + public static final String JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable"; + private JsonNullable anyTypePropNullable = JsonNullable.of(null); + + + public User id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public User username(String username) { + + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public User firstName(String firstName) { + + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFirstName() { + return firstName; + } + + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + + public User lastName(String lastName) { + + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLastName() { + return lastName; + } + + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + + public User email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public User password(String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public User phone(String phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPhone() { + return phone; + } + + + public void setPhone(String phone) { + this.phone = phone; + } + + + public User userStatus(Integer userStatus) { + + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "User Status") + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUserStatus() { + return userStatus; + } + + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + 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 'null' value. + * @return objectWithNoDeclaredProps + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value.") + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getObjectWithNoDeclaredProps() { + return objectWithNoDeclaredProps; + } + + + public void setObjectWithNoDeclaredProps(Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + } + + + public User objectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = JsonNullable.of(objectWithNoDeclaredPropsNullable); + + return this; + } + + /** + * test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + * @return objectWithNoDeclaredPropsNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "test code generation for nullable objects. Value must be a map of strings to values or the 'null' value.") + @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 getObjectWithNoDeclaredPropsNullable_JsonNullable() { + return objectWithNoDeclaredPropsNullable; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + public void setObjectWithNoDeclaredPropsNullable_JsonNullable(JsonNullable objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + } + + public void setObjectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = JsonNullable.of(objectWithNoDeclaredPropsNullable); + } + + + public User anyTypeProp(Object anyTypeProp) { + this.anyTypeProp = JsonNullable.of(anyTypeProp); + + return this; + } + + /** + * 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 + * @return anyTypeProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "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") + @JsonIgnore + + public Object getAnyTypeProp() { + return anyTypeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnyTypeProp_JsonNullable() { + return anyTypeProp; + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + public void setAnyTypeProp_JsonNullable(JsonNullable anyTypeProp) { + this.anyTypeProp = anyTypeProp; + } + + public void setAnyTypeProp(Object anyTypeProp) { + this.anyTypeProp = JsonNullable.of(anyTypeProp); + } + + + public User anyTypePropNullable(Object anyTypePropNullable) { + this.anyTypePropNullable = JsonNullable.of(anyTypePropNullable); + + return this; + } + + /** + * 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. + * @return anyTypePropNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "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.") + @JsonIgnore + + public Object getAnyTypePropNullable() { + return anyTypePropNullable.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnyTypePropNullable_JsonNullable() { + return anyTypePropNullable; + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + public void setAnyTypePropNullable_JsonNullable(JsonNullable anyTypePropNullable) { + this.anyTypePropNullable = anyTypePropNullable; + } + + public void setAnyTypePropNullable(Object anyTypePropNullable) { + this.anyTypePropNullable = JsonNullable.of(anyTypePropNullable); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + 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.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) && + Objects.equals(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) && + Objects.equals(this.anyTypeProp, user.anyTypeProp) && + Objects.equals(this.anyTypePropNullable, user.anyTypePropNullable); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, anyTypeProp, anyTypePropNullable); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + 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(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java new file mode 100644 index 000000000000..64c82e711aca --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java @@ -0,0 +1,163 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Whale + */ +@JsonPropertyOrder({ + Whale.JSON_PROPERTY_HAS_BALEEN, + Whale.JSON_PROPERTY_HAS_TEETH, + Whale.JSON_PROPERTY_CLASS_NAME +}) + +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 hasBaleen(Boolean hasBaleen) { + + this.hasBaleen = hasBaleen; + return this; + } + + /** + * Get hasBaleen + * @return hasBaleen + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HAS_BALEEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasBaleen() { + return hasBaleen; + } + + + 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 + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HAS_TEETH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasTeeth() { + return hasTeeth; + } + + + public void setHasTeeth(Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + } + + + public Whale className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java new file mode 100644 index 000000000000..84436cf0de92 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java @@ -0,0 +1,173 @@ +/* + * 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.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +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 +}) + +public class Zebra extends HashMap { + /** + * 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 type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Zebra className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.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) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, className, super.hashCode()); + } + + + @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("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + From 84d99a5fb0b0827a47de2ac19b897db350d46ac5 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 5 Jun 2020 01:42:46 +0800 Subject: [PATCH 3/4] fix datetime initialize --- .../openapitools/codegen/languages/AbstractJavaCodegen.java | 3 +-- .../client/petstore/java/jersey2-java8/docs/FakeApi.md | 2 +- .../src/main/java/org/openapitools/client/api/FakeApi.java | 4 ++-- .../java/org/openapitools/client/model/InlineObject3.java | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index ec05101519f3..0afb3603c57d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -862,8 +862,7 @@ public String toDefaultValue(Schema schema) { LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); return String.format(Locale.ROOT, localDate.toString(), ""); } else if (schema.getDefault() instanceof java.time.OffsetDateTime) { - return String.format(Locale.ROOT, - ((java.time.OffsetDateTime) schema.getDefault()).atZoneSameInstant(ZoneId.systemDefault()).toString(), ""); + return "OffsetDateTime.parse(\"" + String.format(Locale.ROOT, ((java.time.OffsetDateTime) schema.getDefault()).atZoneSameInstant(ZoneId.systemDefault()).toString(), "") + "\", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault()))"; } else { _default = (String) schema.getDefault(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md index 29e37b5770e3..9c912ded09eb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -670,7 +670,7 @@ Name | Type | Description | Notes **string** | **String**| None | [optional] **binary** | **File**| None | [optional] **date** | **LocalDate**| None | [optional] - **dateTime** | **OffsetDateTime**| None | [optional] [default to 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]] + **dateTime** | **OffsetDateTime**| None | [optional] [default to OffsetDateTime.parse("2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault()))] **password** | **String**| None | [optional] **paramCallback** | **String**| None | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index 8f9179fa787b..eed4c3185988 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -639,7 +639,7 @@ public ApiResponse testClientModelWithHttpInfo(Client client) throws Api * @param string None (optional) * @param binary None (optional) * @param date None (optional) - * @param dateTime None (optional, default to 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]) + * @param dateTime None (optional, default to OffsetDateTime.parse("2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault()))) * @param password None (optional) * @param paramCallback None (optional) * @throws ApiException if fails to make API call @@ -668,7 +668,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @param string None (optional) * @param binary None (optional) * @param date None (optional) - * @param dateTime None (optional, default to 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]) + * @param dateTime None (optional, default to OffsetDateTime.parse("2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault()))) * @param password None (optional) * @param paramCallback None (optional) * @return ApiResponse<Void> diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java index 831f53670301..7cf78a40b3de 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java @@ -82,7 +82,7 @@ public class InlineObject3 { private LocalDate date; public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; - private OffsetDateTime dateTime = 2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]; + private OffsetDateTime dateTime = OffsetDateTime.parse("2010-02-01T17:20:10.111110+08:00[Asia/Hong_Kong]", java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault())); public static final String JSON_PROPERTY_PASSWORD = "password"; private String password; From 156058ef684e72c6ab647d773dac61c78d078d64 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 5 Jun 2020 09:51:31 +0800 Subject: [PATCH 4/4] comment out ensure uptodate --- bin/utils/ensure-up-to-date | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 42111834d7c7..3493cbbbf5b7 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -40,7 +40,7 @@ declare -a samples=( "${root}/bin/python-server-all.sh" "${root}/bin/openapi3/python-petstore.sh" "${root}/bin/openapi3/python-experimental-petstore.sh" -"${root}/bin/openapi3/java-petstore-jersey2-java8.sh" +#"${root}/bin/openapi3/java-petstore-jersey2-java8.sh" "${root}/bin/php-petstore.sh" "${root}/bin/php-silex-petstore-server.sh" "${root}/bin/php-symfony-petstore.sh"